Produced by Araxis Merge on 4/12/2018 10:18:30 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | MSSRe Build 4.zip\Applications\OncoTrax-E40 | ONC_RequestEDITS.cpp | Tue Apr 10 19:43:38 2018 UTC |
| 2 | MSSRe Build 4.zip\Applications\OncoTrax-E40 | ONC_RequestEDITS.cpp | Wed Apr 11 17:41:59 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 1150 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 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 EDIT S request processing classes f or * / | |
| 7 | /* On cology Web -service * / | |
| 8 | /********* ********** ********** ********** ********** ********** ********** ********** / | |
| 9 | ||
| 10 | #include " stdafx.h" | |
| 11 | #include " OncologyCG I.h" | |
| 12 | #include " ONC_Reques ts.h" | |
| 13 | ||
| 14 | /********* ********** ********** ********** ********** ********** ********** ********** / | |
| 15 | /* CO NFIGURATIO N MANAGEME NT * / | |
| 16 | /*-------- ---------- ---------- ---------- ---------- ---------- ---------- ---------* / | |
| 17 | /* !!! CONFI GURATIONS MUST BE LI STED IN AL PHABETICAL ORDER !!! * / | |
| 18 | /********* ********** ********** ********** ********** ********** ********** ********** / | |
| 19 | ||
| 20 | static con st TONCEDI TSConfig C onfigs[] = { | |
| 21 | {/ / Name Metafile Record L ength | |
| 22 | "DEB UG", "METAFILE. RMF", 6694, | |
| 23 | {// Edit Set Name Op tions | |
| 24 | { "Veteran s_Administ ration", 2 }, | |
| 25 | { NULL } | |
| 26 | }, | |
| 27 | {// Edit Nam e Opti ons | |
| 28 | { "Behavio r Code ICD O3, Seq Nu m--Central (SEER IF1 14)", EE _SUPPRESS }, | |
| 29 | { "Behavio r ICDO3, S ite, Histo logy ICDO3 (NAACCR)" , EE_S UPPRESS }, | |
| 30 | { "Cancer Status (CO C)", EE_SKIPEMP TY }, | |
| 31 | { "Cause o f Death (S EER COD)", EE_SKIPE MPTY }, | |
| 32 | { "Cervix In Situ IC DO2 (SEER IF88)", EE_SUPPR ESS }, | |
| 33 | { "Cervix In Situ IC DO3 (SEER IF88)", EE_SUPPR ESS }, | |
| 34 | { "Date of Last Cont act, Date of Diag. ( NAACCR IF1 9)", EE _SKIPEMPTY }, | |
| 35 | { "Date of Last Cont act (NAACC R DATEEDIT )", EE_SKI PEMPTY }, | |
| 36 | { "Diagnos tic Confir m, Seq Num --Central (SEER IF23 )", EE_S UPPRESS }, | |
| 37 | { "Follow- Up Source, Date of D iagnosis ( COC)", EE_S KIPEMPTY }, | |
| 38 | { "Follow- up source Central (N AACCR)", EE_SUP PRESS }, | |
| 39 | { "ICD Rev ision Numb er, Cause of Death ( SEER IF37) ", EE_S KIPEMPTY }, | |
| 40 | { "Next Fo llow-Up So urce, Date of Diagno sis (COC)" , EE_S KIPEMPTY }, | |
| 41 | { "PIN III ICDO3, Da te of Diag nosis (SEE R IF110)", EE_S UPPRESS }, | |
| 42 | { "RX Date --Rad Ende d, Date La st Contact (COC)", EE_S KIPEMPTY }, | |
| 43 | { "RX Date --Surgical Disch, Da te Last Co ntact (COC )", EE_S KIPEMPTY }, | |
| 44 | { "RX Date --Systemic , Date Las t Contact (COC)", EE_S KIPEMPTY }, | |
| 45 | { "Seq Num --Central, Prim Site , Morph IC DO3(SEER I F22", EE _SUPPRESS }, | |
| 46 | { "Type of Rep Srce( DC),Seq Nu m--Cent,IC DO2(SEER I F04", EE _SUPPRESS }, | |
| 47 | { "Type of Rep Srce( DC),Seq Nu m--Cent,IC DO3(SEER I F04", EE _SUPPRESS }, | |
| 48 | { "Vital S tatus (COC )", EE_SKIPEMP TY }, | |
| 49 | { NULL } | |
| 50 | }, | |
| 51 | {// Field Na me Opti ons | |
| 52 | { "Social Security N umber", EE_SUPPRES S }, | |
| 53 | { "Follow- Up Source Central", EE_SUPPRES S }, | |
| 54 | { NULL } | |
| 55 | } | |
| 56 | }, | |
| 57 | {/ / Name Metafile Record L ength | |
| 58 | "DEF AULT", "METAFILE. RMF", 6694, | |
| 59 | {// Edit Set Name Op tions | |
| 60 | { "Veteran s_Administ ration", 2 }, | |
| 61 | { NULL } | |
| 62 | }, | |
| 63 | {// Edit Nam e Opti ons | |
| 64 | { "Behavio r Code ICD O3, Seq Nu m--Central (SEER IF1 14)", EE _SUPPRESS }, | |
| 65 | { "Behavio r ICDO3, S ite, Histo logy ICDO3 (NAACCR)" , EE_S UPPRESS }, | |
| 66 | { "Cancer Status (CO C)", EE_SKIPEMP TY }, | |
| 67 | { "Cause o f Death (S EER COD)", EE_SKIPE MPTY }, | |
| 68 | { "Cervix In Situ IC DO2 (SEER IF88)", EE_SUPPR ESS }, | |
| 69 | { "Cervix In Situ IC DO3 (SEER IF88)", EE_SUPPR ESS }, | |
| 70 | { "Date of Last Cont act, Date of Diag. ( NAACCR IF1 9)", EE _SKIPEMPTY }, | |
| 71 | { "Date of Last Cont act (NAACC R DATEEDIT )", EE_SKI PEMPTY }, | |
| 72 | { "Diagnos tic Confir m, Seq Num --Central (SEER IF23 )", EE_S UPPRESS }, | |
| 73 | { "Follow- Up Source, Date of D iagnosis ( COC)", EE_S KIPEMPTY }, | |
| 74 | { "Follow- up source Central (N AACCR)", EE_SUP PRESS }, | |
| 75 | { "ICD Rev ision Numb er, Cause of Death ( SEER IF37) ", EE_S KIPEMPTY }, | |
| 76 | { "Next Fo llow-Up So urce, Date of Diagno sis (COC)" , EE_S KIPEMPTY }, | |
| 77 | { "PIN III ICDO3, Da te of Diag nosis (SEE R IF110)", EE_S UPPRESS }, | |
| 78 | { "RX Date --Rad Ende d, Date La st Contact (COC)", EE_S KIPEMPTY }, | |
| 79 | { "RX Date --Surgical Disch, Da te Last Co ntact (COC )", EE_S KIPEMPTY }, | |
| 80 | { "RX Date --Systemic , Date Las t Contact (COC)", EE_S KIPEMPTY }, | |
| 81 | { "Seq Num --Central, Prim Site , Morph IC DO3(SEER I F22", EE _SUPPRESS }, | |
| 82 | { "Type of Rep Srce( DC),Seq Nu m--Cent,IC DO2(SEER I F04", EE _SUPPRESS }, | |
| 83 | { "Type of Rep Srce( DC),Seq Nu m--Cent,IC DO3(SEER I F04", EE _SUPPRESS }, | |
| 84 | { "Vital S tatus (COC )", EE_SKIPEMP TY }, | |
| 85 | { NULL } | |
| 86 | }, | |
| 87 | {// Field Na me Opti ons | |
| 88 | { "Follow- Up Source Central", EE_SUPPRES S }, | |
| 89 | { NULL } | |
| 90 | } | |
| 91 | }, | |
| 92 | {/ / Name Metafile Record L ength | |
| 93 | "FUL L", "METAFILE. RMF", 6694, | |
| 94 | {// Edit Set Name Op tions | |
| 95 | { "Veteran s_Administ ration", 2 }, | |
| 96 | { NULL } | |
| 97 | }, | |
| 98 | {// Edit Nam e Opti ons | |
| 99 | { NULL } | |
| 100 | }, | |
| 101 | {// Field Na me Opti ons | |
| 102 | { "Follow- Up Source Central", EE_SUPPRES S }, | |
| 103 | { NULL } | |
| 104 | } | |
| 105 | }, | |
| 106 | {/ / Name Metafile Record L ength | |
| 107 | "NCD B11B", "NCD_110B. RMF", 6694, | |
| 108 | {// Edit Set Name Op tion | |
| 109 | { "*", 2 }, | |
| 110 | { NULL } | |
| 111 | }, | |
| 112 | {// Edit Nam e Opti ons | |
| 113 | { NULL } | |
| 114 | }, | |
| 115 | {// Field Na me Opti on | |
| 116 | { NULL } | |
| 117 | } | |
| 118 | } | |
| 119 | }; | |
| 120 | ||
| 121 | static int compare_c onfigs( co nst void * arg1, cons t void *ar g2 ) | |
| 122 | { | |
| 123 | re turn _stri cmp( ((TON CEDITSConf ig*)arg1)- >Name, ((T ONCEDITSCo nfig*)arg2 )->Name ); | |
| 124 | } | |
| 125 | ||
| 126 | static TON CEDITSConf ig* findED ITSConfig( const char * ConfigNa me) | |
| 127 | { | |
| 128 | TO NCEDITSCon fig key = { ConfigNa me }; | |
| 129 | re turn (TONC EDITSConfi g*)bsearch (&key, Con figs, size of(Configs )/sizeof(C onfigs[0]) , | |
| 130 | size of(Configs [0]), comp are_config s); | |
| 131 | } | |
| 132 | ||
| 133 | /********* ********** ********** ********** ********** ********** ********** ********** / | |
| 134 | /* G ENERIC EDI TS REQUEST * / | |
| 135 | /********* ********** ********** ********** ********** ********** ********** ********** / | |
| 136 | ||
| 137 | TONCReqED: :TONCReqED (const TON CTagCode a Code): TON CRequest(a Code) | |
| 138 | { | |
| 139 | Co nfig = NUL L; | |
| 140 | Me tafile = " "; | |
| 141 | Me tafileVers ion = ""; | |
| 142 | } | |
| 143 | ||
| 144 | TONCReqED: :~TONCReqE D() | |
| 145 | { | |
| 146 | EE _Exit(); | |
| 147 | TO NCRequest: :~TONCRequ est(); | |
| 148 | } | |
| 149 | ||
| 150 | //***** PR OCESSES TH E OPENING TAG | |
| 151 | ||
| 152 | bool TONCR eqED::pars eTagStart( TONCParser * Parser, const TONC TagCode Ta gCode, con st XML_Cha r **atts) | |
| 153 | { | |
| 154 | bo ol prc = T ONCRequest ::parseTag Start(Pars er, TagCod e, atts); | |
| 155 | ||
| 156 | if ( TagCode == getCode () ) | |
| 157 | { | |
| 158 | //-- - Get the name of th e configur ation | |
| 159 | cons t XML_Char * cfgname = TONCPars er::getAtt rVal(atts, "edits-co nfig"); | |
| 160 | if( strlen(cfg name) <= 0 ) | |
| 161 | cfgnam e = "DEFAU LT"; | |
| 162 | ||
| 163 | //-- - Find the configura tion descr iptor | |
| 164 | Conf ig = findE DITSConfig (cfgname); | |
| 165 | if( Config == NULL ) | |
| 166 | throw TONCFault( EC_INVALID _EDITSCFG, cfgname); | |
| 167 | ||
| 168 | //-- - Construc t the name of the ED ITS metafi le | |
| 169 | Meta file = get AppPath(); | |
| 170 | Meta file += Co nfig->Meta file; | |
| 171 | ||
| 172 | //-- - Load the metafile | |
| 173 | char version[8 0]; | |
| 174 | int rc = EE_In it((char*) getMetafil e(), versi on); | |
| 175 | if( rc != 0 ) | |
| 176 | throw TONCFault( EC_EDITS_E RROR, rc, "EE_Init") ; | |
| 177 | ||
| 178 | //-- - Get the version | |
| 179 | char * metaVers ion = GetM etaFileVer sion(); | |
| 180 | if( (metaVersi on != NULL ) && (strl en(metaVer sion) > 0) ) | |
| 181 | Metafi leVersion = metaVers ion; | |
| 182 | else | |
| 183 | Metafi leVersion = version; | |
| 184 | ||
| 185 | retu rn true; | |
| 186 | } | |
| 187 | ||
| 188 | re turn prc; | |
| 189 | } | |
| 190 | ||
| 191 | //***** RE NDERS THE ROOT TAG O F THE RESP ONSE | |
| 192 | ||
| 193 | void TONCR eqED::resp onseTag(bo ol open_ta g) | |
| 194 | { | |
| 195 | if ( open_tag ) | |
| 196 | prin tf("<ED-RE SPONSE xml ns=\"%s\"> \n", getNa mespace()) ; | |
| 197 | el se | |
| 198 | puts ("</ED-RES PONSE>"); | |
| 199 | } | |
| 200 | ||
| 201 | /********* ********** ********** ********** ********** ********** ********** ********** / | |
| 202 | /* EDITS INF O REQUEST * / | |
| 203 | /********* ********** ********** ********** ********** ********** ********** ********** / | |
| 204 | ||
| 205 | TONCReqEDG etEditInfo ::TONCReqE DGetEditIn fo(const T ONCTagCode aCode): T ONCReqED(a Code) | |
| 206 | { | |
| 207 | Ed itIndex = 0; | |
| 208 | Ed itSetName = ""; | |
| 209 | Te xtWidth = 75; | |
| 210 | } | |
| 211 | ||
| 212 | //***** PR OCESSES TH E REQUEST | |
| 213 | ||
| 214 | void TONCR eqEDGetEdi tInfo::exe cute() | |
| 215 | { | |
| 216 | co nst int BU FSIZE = 32 768; | |
| 217 | EE t_mh esHan dle = 0; | |
| 218 | in t retLen, status; | |
| 219 | ||
| 220 | ch ar* buf = new char[B UFSIZE]; | |
| 221 | if ( buf == N ULL ) | |
| 222 | thro w TONCFaul t(EC_NOT_E NOUGH_MEM) ; | |
| 223 | bu f[0] = '\0 '; | |
| 224 | ||
| 225 | tr y | |
| 226 | { | |
| 227 | //-- - Load the requested edit set | |
| 228 | int rc = EE_Lo adEditSet( &esHandle, (char*)Ed itSetName. c_str(), & status, 1) ; | |
| 229 | if( rc != 0 ) | |
| 230 | throw TONCFault( EC_EDITS_E RROR_EX, r c, "EE_Loa dEditSet", "Edit Set name", Ed itSetName. c_str()); | |
| 231 | ||
| 232 | //-- - Get the edit name | |
| 233 | rc = EE_GetEdi tName(esHa ndle, Edit Index, buf ); | |
| 234 | if( rc != 0 ) | |
| 235 | throw TONCFault( EC_EDITS_E RROR, rc, "EE_GetEdi tName"); | |
| 236 | StrT ag("NAME", buf); | |
| 237 | ||
| 238 | //-- - Get the edit descr iption tex t | |
| 239 | if( !EE_GetEdi tDescript( esHandle, EditIndex, TextWidth , BUFSIZE, &retLen, buf, 1) ) | |
| 240 | { | |
| 241 | puts(" <DESCRIPTI ON>"); | |
| 242 | writeS tructuredT ext(buf); | |
| 243 | puts(" </DESCRIPT ION>"); | |
| 244 | } | |
| 245 | ||
| 246 | //-- - Get the edit help text | |
| 247 | if( !EE_GetEdi tHelp(esHa ndle, Edit Index, Tex tWidth, BU FSIZE, &re tLen, buf, 1) ) | |
| 248 | { | |
| 249 | puts(" <HELP>"); | |
| 250 | writeS tructuredT ext(buf); | |
| 251 | puts(" </HELP>"); | |
| 252 | } | |
| 253 | } | |
| 254 | ca tch(...) | |
| 255 | { | |
| 256 | if( esHandle ! = 0 ) | |
| 257 | EE_Fre eEditSet(e sHandle); | |
| 258 | dele te [] buf; | |
| 259 | thro w; | |
| 260 | } | |
| 261 | ||
| 262 | // ---- Free the edit s et | |
| 263 | EE _FreeEditS et(esHandl e); | |
| 264 | de lete [] bu f; | |
| 265 | } | |
| 266 | ||
| 267 | //***** PR OCESSES TH E CLOSING TAG | |
| 268 | ||
| 269 | bool TONCR eqEDGetEdi tInfo::par seTagEnd(T ONCParser* Parser, c onst TONCT agCode Tag Code) | |
| 270 | { | |
| 271 | in t tmp; | |
| 272 | if ( !TONCReq ED::parseT agEnd(Pars er, TagCod e) ) | |
| 273 | swit ch( TagCod e ) | |
| 274 | { | |
| 275 | case EDEI_EDIT : | |
| 276 | EditIn dex = Pars er->TagTex t.getAsInt (); | |
| 277 | break; | |
| 278 | case EDEI_EDIT SET: | |
| 279 | EditSe tName = Pa rser->TagT ext.getAsT ext(); | |
| 280 | break; | |
| 281 | case EDEI_TEXT WIDTH: | |
| 282 | tmp = Parser->T agText.get AsInt(); | |
| 283 | if( tm p > 0 ) | |
| 284 | TextWidt h = tmp; | |
| 285 | break; | |
| 286 | defa ult: | |
| 287 | return false; | |
| 288 | } | |
| 289 | re turn true; | |
| 290 | } | |
| 291 | ||
| 292 | /********* ********** ********** ********** ********** ********** ********** ********** / | |
| 293 | /* ED ITS 'RUN B ATCH' REQU EST * / | |
| 294 | /********* ********** ********** ********** ********** ********** ********** ********** / | |
| 295 | ||
| 296 | TONCReqEDR unBatch::T ONCReqEDRu nBatch(con st TONCTag Code aCode ): TONCReq ED(aCode) | |
| 297 | { | |
| 298 | Re cordHandle = -1; | |
| 299 | } | |
| 300 | ||
| 301 | //***** PR OCESSES TH E REQUEST | |
| 302 | ||
| 303 | void TONCR eqEDRunBat ch::execut e() | |
| 304 | { | |
| 305 | if ( Config-> EditSets[0 ].Name != NULL ) | |
| 306 | { | |
| 307 | char buf[80]; | |
| 308 | int esi, rc; | |
| 309 | ||
| 310 | //-- - If the f irst name in the lis t is "*", execute al l edit set s from the metafile | |
| 311 | if( !strcmp(Co nfig->Edit Sets[0].Na me, "*") ) | |
| 312 | { | |
| 313 | int i, nes; | |
| 314 | rc = E E_GetEditS etCount(&n es); | |
| 315 | if( rc != 0 ) | |
| 316 | throw TO NCFault(EC _EDITS_ERR OR, rc, "E E_GetEditS etCount"); | |
| 317 | for( i =1; i<=nes ; i++) | |
| 318 | { | |
| 319 | rc = EE_ GetEditSet Name(i, bu f); | |
| 320 | if( rc ! = 0 ) | |
| 321 | throw TONC Fault(EC_E DITS_ERROR , rc, "EE_ GetEditSet Name"); | |
| 322 | executeE ditSet(buf ); | |
| 323 | } | |
| 324 | } | |
| 325 | //-- - Otherwis e, execute the edits sets from the list | |
| 326 | else | |
| 327 | for(es i=0; Confi g->EditSet s[esi].Nam e != NULL; esi++ ) | |
| 328 | executeE ditSet(Con fig->EditS ets[esi].N ame, Confi g->EditSet s[esi].Opt ion); | |
| 329 | ||
| 330 | StrT ag("VERSIO N", ONCVER SION); | |
| 331 | StrT ag("METAVE R", getMet afileVersi on()); | |
| 332 | } | |
| 333 | } | |
| 334 | ||
| 335 | //***** EX ECUTES THE SINGLE ED IT SET FRO M THE LIST | |
| 336 | ||
| 337 | void TONCR eqEDRunBat ch::execut eEditSet(c onst char* name, con st int opt ion) | |
| 338 | { | |
| 339 | in t rc, stat us; | |
| 340 | EE t_mh setHa ndle; | |
| 341 | ||
| 342 | // --- Load t he edit se t | |
| 343 | rc = EE_Load EditSet(&s etHandle, (char*)nam e, &status , 1); | |
| 344 | if ( rc != 0 ) | |
| 345 | thro w TONCFaul t(EC_EDITS _ERROR_EX, rc, "EE_L oadEditSet ", "Edit S et name", name); | |
| 346 | tr y | |
| 347 | { | |
| 348 | setF ieldOption s(); | |
| 349 | setE ditOptions (setHandle ); | |
| 350 | ||
| 351 | //-- - Clear th e internal EDITS fla gs | |
| 352 | rc = EE_ClearA llFlags(); | |
| 353 | if( rc != 0 ) | |
| 354 | throw TONCFault( EC_EDITS_E RROR, rc, "EE_ClearA llFlags"); | |
| 355 | ||
| 356 | //-- - Run all edits from the set | |
| 357 | rc = EE_RunBat ch(setHand le, option , &status) ; | |
| 358 | if( rc != 0 ) | |
| 359 | throw TONCFault( EC_EDITS_E RROR_EX, r c, "EE_Run Batch", "E dit Set na me", name) ; | |
| 360 | ||
| 361 | //-- - If error s are retu rned, add them to th e response | |
| 362 | if( status > 0 ) | |
| 363 | output Messages(s etHandle, name); | |
| 364 | } | |
| 365 | ca tch(...) | |
| 366 | { | |
| 367 | EE_F reeEditSet (setHandle ); | |
| 368 | thro w; | |
| 369 | } | |
| 370 | // --- Free t he memory | |
| 371 | EE _FreeEditS et(setHand le); | |
| 372 | } | |
| 373 | ||
| 374 | //***** FO RMATS THE MESSAGES G ENERATED B Y THE EDIT SET AND W RITES THEM TO THE ST DOUT | |
| 375 | ||
| 376 | void TONCR eqEDRunBat ch::output Messages(E Et_mh setH andle, con st char* s etName) | |
| 377 | { | |
| 378 | in t mc, prev _edit_inde x = -1, rc ; | |
| 379 | ex tern int G lobalInput DataHasErr or; | |
| 380 | ||
| 381 | // --- Get th e number o f messages | |
| 382 | rc = EE_GetM essageCoun t(&mc); | |
| 383 | if ( rc != 0 ) | |
| 384 | thro w TONCFaul t(EC_EDITS _ERROR, rc , "EE_GetM essageCoun t"); | |
| 385 | ||
| 386 | // --- Write the messag es to the stdout im XML format | |
| 387 | if ( mc > 0 ) | |
| 388 | { | |
| 389 | //-- - Group th e messages under the edit set | |
| 390 | prin tf("<EDIT- SET NAME=\ "%s\" ECNT =\"%d\">\n ", xmlEnco de(setName ).c_str(), mc); | |
| 391 | try | |
| 392 | { | |
| 393 | const int BUFSIZ E = 160; | |
| 394 | int po s, edit_in dex, ifld, imsg, num _fields, t mp; | |
| 395 | char e dit_name[6 0], msg_ty pe[5], msg _text[BUFS IZE], fiel d_name[BUF SIZE], buf [BUFSIZE]; | |
| 396 | long e rr_code, n um_err, nu m_warn, nu m_skip; | |
| 397 | ||
| 398 | for( i msg=1; ims g<=mc; ims g++ ) | |
| 399 | { | |
| 400 | //--- Ge t the mess age data | |
| 401 | rc = EE_ GetMessage TextEx(msg _type, ims g, msg_tex t, BUFSIZE , &err_cod e, &tmp, & edit_index , edit_nam e, &tmp); | |
| 402 | if( rc ! = 0 ) | |
| 403 | throw TONC Fault(EC_E DITS_ERROR , rc, "EE_ GetMessage TextEx"); | |
| 404 | ||
| 405 | //--- Gr oup the me ssages by edits | |
| 406 | if( edit _index != prev_edit_ index ) | |
| 407 | { | |
| 408 | //--- Edit info | |
| 409 | rc = EE_Ge tEditCount s(setHandl e, edit_in dex, &num_ fields, &n um_err, &n um_warn, & num_skip); | |
| 410 | if( rc != 0 ) | |
| 411 | th row TONCFa ult(EC_EDI TS_ERROR, rc, "EE_Ge tEditCount s"); | |
| 412 | ||
| 413 | if( prev_e dit_index >= 0 ) | |
| 414 | pu ts("</EDIT >"); | |
| 415 | printf("<E DIT INDEX= \"%d\" NAM E=\"%s\" E CNT=\"%ld\ " WCNT=\"% ld\">\n", | |
| 416 | ed it_index, xmlEncode( edit_name) .c_str(), num_err, n um_warn); | |
| 417 | prev_edit_ index = ed it_index; | |
| 418 | ||
| 419 | //--- Fiel ds validat ed by the edit | |
| 420 | for(ifld=1 ; ifld<=nu m_fields; ifld++) | |
| 421 | { | |
| 422 | // --- Start position o f the fiel d | |
| 423 | //JJB 1001 05 the spr intf's bec ame _s ver sions | |
| 424 | sp rintf_s(bu f, sizeof( buf), "%%C %d", ifld) ; | |
| 425 | EE _GetEditIn fo(setHand le, edit_i ndex, buf, buf, BUFS IZE); | |
| 426 | po s = atoi(b uf+1); | |
| 427 | // --- Field name | |
| 428 | //JJB 1001 05 | |
| 429 | sp rintf_s(bu f, sizeof( buf), "%%F %d", ifld) ; | |
| 430 | EE _GetEditIn fo(setHand le, edit_i ndex, buf, field_nam e, BUFSIZE ); | |
| 431 | // --- Value of the fie ld | |
| 432 | //JJB 1001 05 | |
| 433 | sp rintf_s(bu f, sizeof( buf), "%%V %d", ifld) ; | |
| 434 | EE _GetEditIn fo(setHand le, edit_i ndex, buf, buf, BUFS IZE); | |
| 435 | // --- Write the tags | |
| 436 | pr intf("<FLD NAME=\"%s \" POS=\"% d\">%s</FL D>\n", | |
| 437 | xmlE ncode(fiel d_name).c_ str(), pos , xmlEncod e(buf).c_s tr()); | |
| 438 | ||
| 439 | Gl obalInputD ataHasErro r++; | |
| 440 | } | |
| 441 | } | |
| 442 | ||
| 443 | //--- Me ssage | |
| 444 | printf(" <MSG CODE= \"%d\" TYP E=\"%s\">" , err_code , msg_type ); | |
| 445 | writeTex t(msg_text ); | |
| 446 | puts("</ MSG>"); | |
| 447 | GlobalIn putDataHas Error++; | |
| 448 | } | |
| 449 | } | |
| 450 | catc h(...) | |
| 451 | { | |
| 452 | if( pr ev_edit_in dex >= 0 ) | |
| 453 | puts("</ EDIT>"); | |
| 454 | puts(" </EDIT-SET >"); | |
| 455 | throw; | |
| 456 | } | |
| 457 | if( prev_edit_ index >= 0 ) | |
| 458 | puts(" </EDIT>"); | |
| 459 | puts ("</EDIT-S ET>"); | |
| 460 | } | |
| 461 | } | |
| 462 | ||
| 463 | //***** PR OCESSES TH E CLOSING TAG | |
| 464 | ||
| 465 | bool TONCR eqEDRunBat ch::parseT agEnd(TONC Parser* Pa rser, cons t TONCTagC ode TagCod e) | |
| 466 | { | |
| 467 | in t rc; | |
| 468 | ch ar* layout NameWithVe rsion; | |
| 469 | ||
| 470 | if ( !TONCReq ED::parseT agEnd(Pars er, TagCod e) ) | |
| 471 | swit ch( TagCod e ) | |
| 472 | { | |
| 473 | case EDRB_NAAC CR_RECORD: | |
| 474 | //--- Allocate i nternal bu ffer for t he NAACCR record | |
| 475 | rc = E E_AllocRec ord(Config ->RecordLe ngth, &Rec ordHandle) ; | |
| 476 | if( rc != 0 ) | |
| 477 | throw TO NCFault(EC _EDITS_ERR OR, rc, "E E_AllocRec ord"); | |
| 478 | ||
| 479 | //--- Load and i nitialize the record layout | |
| 480 | layout NameWithVe rsion = Ge tMetaFileL ayoutName( ); | |
| 481 | ||
| 482 | rc = E E_InitReco rdLayout(R ecordHandl e, layoutN ameWithVer sion); | |
| 483 | if( rc != 0 ) | |
| 484 | throw TO NCFault(EC _EDITS_ERR OR_EX, rc, "EE_InitR ecordLayou t", "Layou t name", l ayoutNameW ithVersion ); | |
| 485 | ||
| 486 | //--- Load the d ata into t he interna l buffer | |
| 487 | char* data; | |
| 488 | data = (char*) P arser->Tag Text.getAs Text(); | |
| 489 | rc = E E_UpdateRe cord(Recor dHandle, d ata); | |
| 490 | ||
| 491 | //--- Write the data into output fil e | |
| 492 | try | |
| 493 | { | |
| 494 | Parser-> WriteOutpu tFile(data ); | |
| 495 | } | |
| 496 | catch( TONCFault Fault) | |
| 497 | { | |
| 498 | Fault.ou tput(); | |
| 499 | } | |
| 500 | ||
| 501 | if( rc != 0 ) | |
| 502 | throw TO NCFault(EC _EDITS_ERR OR, rc, "E E_UpdateRe cord"); | |
| 503 | ||
| 504 | break; | |
| 505 | defa ult: | |
| 506 | return false; | |
| 507 | } | |
| 508 | re turn true; | |
| 509 | } | |
| 510 | ||
| 511 | ||
| 512 | //***** PA SSES EDIT OPTIONS FR OM THE CON FIGURATION TO THE ED ITS ENGINE | |
| 513 | ||
| 514 | void TONCR eqEDRunBat ch::setEdi tOptions(E Et_mh Edit SetHandle) | |
| 515 | { | |
| 516 | in t eh, ei, eopts, rc; | |
| 517 | fo r(ei=0; Co nfig->Edit s[ei].Name != NULL; ei++) | |
| 518 | { | |
| 519 | //-- - Get edit handle | |
| 520 | rc = EE_GetEdi tHandle(Ed itSetHandl e, &eh, (c har*)(Conf ig->Edits[ ei].Name)) ; | |
| 521 | if( rc != 0 ) | |
| 522 | throw TONCFault( EC_EDITS_E RROR_EX, r c, "EE_Get EditHandle ", "Edit n ame", Conf ig->Edits[ ei].Name); | |
| 523 | ||
| 524 | //-- - Set edit options | |
| 525 | if( eh >= 0 ) | |
| 526 | { | |
| 527 | eopts = Config-> Edits[ei]. Options; | |
| 528 | rc = E E_EditOpti ons(EditSe tHandle, e h, &eopts) ; | |
| 529 | if( rc != 0 ) | |
| 530 | throw TO NCFault(EC _EDITS_ERR OR_EX, rc, "EE_EditO ptions", " Edit name" , Config-> Edits[ei]. Name); | |
| 531 | } | |
| 532 | } | |
| 533 | } | |
| 534 | ||
| 535 | //***** PA SSES FIELD OPTIONS F ROM THE CO NFIGURATIO N TO THE E DITS ENGIN E | |
| 536 | ||
| 537 | void TONCR eqEDRunBat ch::setFie ldOptions( void) | |
| 538 | { | |
| 539 | in t fh, fi, fopts, rc; | |
| 540 | ch ar* layout NameWithVe rsion; | |
| 541 | ||
| 542 | la youtNameWi thVersion = GetMetaF ileLayoutN ame(); | |
| 543 | fo r(fi=0; Co nfig->Fiel ds[fi].Nam e != NULL; fi++) | |
| 544 | { | |
| 545 | //-- - Get fiel d handle | |
| 546 | fh = EE_FieldH andle((cha r*)(Config ->Fields[f i].Name), "S", layou tNameWithV ersion); | |
| 547 | if( fh < 0 ) | |
| 548 | throw TONCFault( EC_EDITS_E RROR_EX, f h, "EE_Fie ldHandle", "Field na me", Confi g->Fields[ fi].Name); | |
| 549 | ||
| 550 | //-- - Set fiel d options | |
| 551 | fopt s = Config ->Fields[f i].Options ; | |
| 552 | rc = EE_FieldO ptions(fh, &fopts); | |
| 553 | if( rc != 0 ) | |
| 554 | throw TONCFault( EC_EDITS_E RROR_EX, r c, "EE_Fie ldOptions" , "Field n ame", Conf ig->Fields [fi].Name) ; | |
| 555 | } | |
| 556 | } | |
| 557 | ||
| 558 | char* TONC ReqEDRunBa tch::GetMe taFileLayo utName() | |
| 559 | { | |
| 560 | ch ar* layout Name = (ch ar*) mallo c(30); | |
| 561 | TO NCParser* Parser; | |
| 562 | ||
| 563 | st rcpy(layou tName, "NA ACCR DATA EXCHANGE V S "); | |
| 564 | st rcat(layou tName, Par ser->GetCo nfigValue( INI_FILE_N AME, VERSI ON_CONFIG_ VALUE_STAR T_TAG, VER SION_CONFI G_VALUE_EN D_TAG)); | |
| 565 | la youtName[( int) strle n(layoutNa me)] = 0; | |
| 566 | ||
| 567 | re turn layou tName; | |
| 568 | } | |
| 569 | ||
| 570 | ||
| 571 | char* TONC ReqED::Get MetaFileVe rsion() | |
| 572 | { | |
| 573 | TO NCParser* Parser; | |
| 574 | ||
| 575 | re turn Parse r->GetConf igValue(IN I_FILE_NAM E, VERSION _CONFIG_VA LUE_START_ TAG, VERSI ON_CONFIG_ VALUE_END_ TAG); | |
| 576 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.