@@ -271,7 +271,7 @@ int record::IsSetAny(
271271 }
272272} // record::IsSetAny
273273// -----------------------------------------------------------------------------
274- int record::IsValAll (
274+ int record::IsValAll ( // check for resolved (non-expression) values
275275 int fn, ...) const // 0 terminated fn list (don't forget the 0!)
276276// return 1 iff all fields have values
277277{ va_list ap;
@@ -365,23 +365,49 @@ o what );
365365} // record::classObjTx
366366// =============================================================================
367367
368- // ***************************************************************************************************************************
368+ // /////////////////////////////////////////////////////////////////////////////
369+ // public helper functions
370+ // /////////////////////////////////////////////////////////////////////////////
371+ RC ArrayStatus ( // count/check status of ARRAY elements
372+ const UCH* _sstat0, // status array
373+ int count, // # of values to check (dimension of array
374+ int & nSet, // returned: # of array elements set (FsSet)
375+ int & nVal) // returned: # of array elements with value (FsVAL)
376+ // re checking of ARRAY input
377+ // returns RCOK on success
378+ // RCBAD iff malformed (impossible unless bug?)
379+ {
380+ RC rc = RCOK;
381+ int n0 = 0 ; // # of 0 status
382+ nSet = nVal = 0 ;
383+ for (int fn=0 ; fn < count; fn++)
384+ { int stat = _sstat0[ fn];
385+ if (stat == 0 )
386+ n0++;
387+ else
388+ { if (n0)
389+ rc = RCBAD; // 0 followed by non-0
390+ if (stat & FsSET)
391+ nSet++;
392+ if (stat & FsVAL)
393+ nVal++;
394+ }
395+ }
396+ return rc;
397+ } // ::ArrayStatus
398+ // =============================================================================
399+
400+ // *****************************************************************************
369401// class basAnc: base class for application record anchors.
370- // ***************************************************************************************************************************
402+ // *****************************************************************************
371403
372404// --- variables re "anchor numbers". ancBase.ancN contains #.
373- #if defined( ANC_DTOR)
374405const int MAXANCS = 200 ; // Maximum number of basAncs supported
375406 // actual required = ~65 12-20-2012
376407static BP ancs[ MAXANCS]; // table of pointers to contructed basAncs
377408 // persists for entire session re multiple DLL cse() calls
378409 // "big enuf" static array simplifies persistence
379410static int Nanc = -1 ; // # of entries in anc[] (-1 = unintialized) (see regis())
380- #else
381- LOCAL BP * NEAR ancs = NULL ; // dm array of NEAR ptrs to basAncs by #. excludes b.tyB's (not regis'd by cul.cpp).
382- LOCAL USI NEAR Nanc = 0 ; // max ancN in use (0 unused)
383- LOCAL USI NEAR ancNal = 0 ; // ancs size: # #'s allocated
384- #endif
385411// ---------------------------------------------------------------------------------------
386412basAnc::basAnc () // default c'tor (for derived copy c'tor
387413{
@@ -405,16 +431,13 @@ basAnc::basAnc( USI _flags, SFIR * _fir, USI _nFlds, char * _what, USI _eSz, RCT
405431// --------------------------------------------------------------------------------------------------------------
406432/* virtual*/ basAnc::~basAnc () // d'tor
407433{
408- #if defined( ANC_DTOR)
409434 if (flags & RFTYS)
410435 dmfree ( DMPP ( what));
411- #endif
412436} // basAnc::~basAnc
413437// ---------------------------------------------------------------------------------------------------------------------------
414438void FC basAnc::regis () // "register" anchor for nextAnc() iteration. Constructor helper.
415439{
416440 int an;
417- #if defined( ANC_DTOR)
418441 if (Nanc < 0 ) // if not initialized
419442 { VZero ( ancs, MAXANCS);
420443 Nanc = 0 ;
@@ -423,12 +446,6 @@ void FC basAnc::regis() // "register" anchor for nextAnc() iteration. Constr
423446 ; // (or one already set for this anc: reconstr insurance)
424447 if (an >= MAXANCS)
425448 err ( PABT, " Insufficient anc[] space" );
426- #else
427- if (!ancs || ancNal < Nanc + 2 ) // if necessary
428- dmral ( DMPP ( ancs), (ancNal += 32 ) * sizeof (BP), DMZERO|ABT); // enlarge array of pointers
429- for (an = 1 ; ancs[an] && ancs[an] != this ; an++) // find free pointer
430- ; // (or one already set for this anc: reconstr insurance)
431- #endif
432449 ancs[an] = this ; // set pointer in static array
433450 Nanc = max ( Nanc, an);
434451 ancN = an; // set index in anchor
@@ -452,30 +469,15 @@ void FC cleanBasAncs( // destroy/free all basAnc records, and delete subsidiary
452469 if (!b)
453470 continue ; // skip (unexpected) NULL pointer
454471 b->free (); // destroy b's records, free record memory unless static, clear flags
455- #if defined( ANC_DTOR)
456472 delete b->tyB ;
457473 b->tyB = NULL ;
458- #else
459- if (b->tyB ) // if b has a subsidiary "types" ancRec (not registered; in heap)
460- {
461- b->tyB ->free (); // destroy/free its records (believed redundant)
462- dmfree ( DMPP ( b->tyB ->what )); // free its "what" string if non-NULL, set pointer NULL
463- delete (basAnc *)b->tyB ; // destroy types basAnc and free its memory. cast makes ptr pointer.
464- b->tyB = 0 ; // 16-bit-NULL tyB pointer
465- }
466- #endif
467474 }
468475
469- if (cs == DONE || cs == CRASH)
470- {
471- #if !defined( ANC_DTOR)
472- Nanc = 0 ;
473- ancNal = 0 ;
474- dmfree ( DMPP ( ancs));
475- #endif
476- }
477- // else
478- // ancs[] is built by c'tor, thus must persist from entry to entry (all non-tyB ancRecs believed static).
476+ // if (cs == DONE || cs == CRASH)
477+ // { // nothing to do
478+ // }
479+ // else
480+ // ancs[] is built by c'tor, thus must persist from entry to entry (all non-tyB ancRecs believed static).
479481
480482 clearFileIxs (); // clear file names referenced by record.fileIx members
481483} // cleanBasAncs
0 commit comments