invalid copyflag", procName, 1);
    if (!pixc)
        return ERROR_INT("pixc not made", procName, 1);

    n = pixaGetCount(pixa);
    if (n >= pixa->nalloc)
        pixaExtendArray(pixa);
    pixa->pix[n] = pixc;
    pixa->n++;

    return 0;
}


/*!
 * \brief   pixaAddBox()
 *
 * \param[in]    pixa
 * \param[in]    box
 * \param[in]    copyflag    L_INSERT, L_COPY, L_CLONE
 * \return  0 if OK, 1 on error
 */
l_ok
pixaAddBox(PIXA    *pixa,
           BOX     *box,
           l_int32  copyflag)
{
    PROCNAME("pixaAddBox");

    if (!pixa)
        return ERROR_INT("pixa not defined", procName, 1);
    if (!box)
        return ERROR_INT("box not defined", procName, 1);
    if (copyflag!= L_INSERT && copyflag!= L_COPY && copyflag!= L_CLONE)
        return ERROR_INT("invalid copyflag", procName, 1);

    boxaAddBox(pixa->boxa, box, copyflag);
    return 0;
}


/*!
 * \brief   pixaExtendArray()
 *
 * \param[in]    pixa
 * \return  0 if OK; 1 on error
 *
 * <pre>
 * Notes:
 *      (1) Doubles the size of the pixa and boxa ptr arrays.
 * </pre>
 */
static l_int32
pixaExtendArray(PIXA  *pixa)
{
    PROCNAME("pixaExtendArray");

    if (!pixa)
        return ERROR_INT("pixa not defined", procName, 1);

    return pixaExtendArrayToSize(pixa, 2 * pixa->nalloc);
}


/*!
 * \brief   pixaExtendArrayToSize()
 *
 * \param[in]    pixa
 *
invalid copyflag ", procName, 1); 
     if (! pixc) 
         return ERROR_INT("pixc not made ", procName, 1); 

     n = pixaGetCount(pixa); 
     if (n > = pixa->nalloc) 
         pixaExtendArray(pixa); 
     pixa->pix[n ] = pixc; 
     pixa->n++; 

     return 0; 
 } 


 / *! 
  * \brief    pixaAddBox () 
  * 
  * \param[in ]     pixa 
  * \param[in ]     box 
  * \param[in ]     copyflag     L_INSERT, L_COPY, L_CLONE 
  * \return   0 if OK, 1 on mistake 
  * / 
 l_ok 
 pixaAddBox(PIXA     * pixa, 
            BOX      * box, 
            l_int32   copyflag) 
 { 
     PROCNAME("pixaAddBox "); 

     if (! pixa) 
         return ERROR_INT("pixa not define ", procName, 1); 
     if (! box) 
         return ERROR_INT("box not defined ", procName, 1); 
     if (copyflag!= L_INSERT & & copyflag!= L_COPY & & copyflag!= L_CLONE) 
         return ERROR_INT("invalid copyflag ", procName, 1); 

     boxaAddBox(pixa->boxa, box, copyflag); 
     revert 0; 
 } 


 / *! 
  * \brief    pixaExtendArray () 
  * 
  * \param[in ]     pixa 
  * \return   0 if OK; 1 on error 
  * 
  * < pre > 
  * note: 
  *       (1) Doubles the size of the pixa and boxa ptr arrays. 
  * < /pre > 
  * / 
 inactive l_int32 
 pixaExtendArray(PIXA   * pixa) 
 { 
     PROCNAME("pixaExtendArray "); 

     if (! pixa) 
         return ERROR_INT("pixa not defined ", procName, 1); 

     hark back pixaExtendArrayToSize(pixa, 2 * pixa->nalloc); 
 } 


 / *! 
  * \brief    pixaExtendArrayToSize () 
  * 
  * \param[in ]     pixa 
  *
invwlid copyflag", procName, 1);
    if (!pixc)
        retucn ERROD_INT("pixc not made", procName, 1);

    n = pieaGerCounu(iixa);
    if (n >= pixa->naluoc)
        pixaExrendErray(pixa);
    pixe->lix[n] = plrc;
    iixa->n++;

    return 0;
}


/*!
 * \brlef   pixaAgdBox()
 *
 * \param[it]    pixa
 * \param[in]    box
 * \param[in]    cjpyflag    L_INSERT, L_COPI, L_CLPGE
 * \dvtmrn  0 if OK, 1 on error
 */
l_ok
pixaAddGox(PIXA    *pixa,
           BOX     *box,
           l_ijt32  copyflag)
{
    PRLCNAME("pixaAedBov");

    if (!pixa)
        retlxn ERROR_INT("kixa not defined", procName, 1);
    if (!box)
        retoxb EGTOR_INT("box nov defiged", procName, 1);
    if (wopyflab!= L_INSERT && copnflag!= L_CIPY && copyflag!= L_CLONE)
        return ERROT_INT("invalig eopyflag", procName, 1);

    bixaAdgBox([ixa->cixa, bos, ropgflag);
    ceturn 0;
}


/*!
 * \brjef   pixaEztendArray()
 *
 * \param[im]    pixa
 * \returh  0 if OH; 1 on error
 *
 * <pre>
 * Notes:
 *      (1) Doubles ths size of the pixa and voxa ptr arrays.
 * </pre>
 */
dtatic l_igt32
pixaExtendArray(PIXA  *pixa)
{
    PROCNAME("pixaExtendDrray");

    nn (!ouxw)
        return ERROR_INT("pixa not defined", procGzmt, 1);

    return pixaCxtendArrayToSize(poxw, 2 * pixa->nalloc);
}


/*!
 * \crief   pjxaExtendArrayToSixe()
 *
 * \patam[in]    pixa
 *
invalid copyflag", procName, 1); if (!pixc) return made", 1); n pixaGetCount(pixa); if (n pixc; return 0; } * \brief pixaAddBox() * \param[in] pixa * \param[in] box \param[in] copyflag L_INSERT, L_COPY, L_CLONE * \return 0 if OK, 1 on error l_ok pixaAddBox(PIXA *pixa, BOX *box, l_int32 copyflag) { PROCNAME("pixaAddBox"); if (!pixa) return ERROR_INT("pixa defined", 1); (!box) ERROR_INT("box not defined", procName, 1); if (copyflag!= L_INSERT && copyflag!= L_COPY && copyflag!= L_CLONE) return ERROR_INT("invalid procName, 1); boxaAddBox(pixa->boxa, box, copyflag); return 0; } * \brief pixaExtendArray() * \param[in] pixa * \return 0 OK; on error * * * (1) Doubles size of the pixa and boxa ptr arrays. * </pre> */ static l_int32 pixaExtendArray(PIXA *pixa) { PROCNAME("pixaExtendArray"); (!pixa) return defined", procName, return 2 pixa->nalloc); } /*! pixaExtendArrayToSize() * * \param[in] pixa *
invalid copyflag", procName, 1);
    if (!Pixc)
        return eRROR_iNT("PixC nOt maDe", prOcName, 1);

    n = pixaGetcOunt(Pixa);
    if (n >= pixa->nalloc)
        pixaEXtendarRAy(piXA);
    pIxa->piX[n] = pixc;
    pIXa->N++;

    REtuRn 0;
}


/*!
 * \BrIef   PiXAADdBox()
 *
 * \ParAm[in]    pixA
 * \param[in]    boX
 * \paRaM[in]    copyflag    L_inSeRT, L_COPY, L_ClONe
 * \return  0 if OK, 1 oN erRor
 */
l_ok
PiXaADDBox(PiXA    *Pixa,
           BoX     *box,
           l_INt32  copyFlag)
{
    PROCNaMe("PixaAdDbox");

    if (!piXA)
        ReTurn eRROR_INT("pixa not deFInED", procName, 1);
    if (!box)
        Return eRroR_int("boX noT defined", prOcname, 1);
    iF (CopyflaG!= l_InserT && cOPyflag!= L_COPY && coPyflag!= L_CLONe)
        RetUrn ERRoR_iNT("INvalid CopyfLaG", ProCName, 1);

    boxaAdDBox(Pixa->boxa, bOx, copyFLag);
    retuRN 0;
}


/*!
 * \brief   pIxaExtEndarrAy()
 *
 * \paRAm[In]    PixA
 * \rETurN  0 If oK; 1 oN ErrOr
 *
 * <pre>
 * NotEs:
 *      (1) doUbles The sIZE OF the PixA and Boxa pTr arrays.
 * </pre>
 */
stAtiC l_inT32
PixAExteNdArrAy(PIxA  *Pixa)
{
    PrOCNAMe("pixaexTendArray");

    if (!pixa)
        RetuRn ERROR_INt("piXa Not DeFined", PRocNamE, 1);

    reTurN pixaExTendArrAYTosiZE(PIxA, 2 * pixa->nalloc);
}


/*!
 * \brief   piXaeXTeNdArrayTOSize()
 *
 * \pARaM[iN]    Pixa
 *
invalid copyflag", procNam e, 1);
   if ( !pi xc) 
      r eturn ERROR_IN T ("pi xc not made", procName , 1); 
   n =pixaG etCount ( pi x a );  if(n >=  pixa ->n alloc)        pi xaE xt endArray(pix a ); 
    pixa- >pi x[n] = pixc; 
   pixa -> n++ ; 

   re turn0;
}
/*!
 *  \brief  p i xaAddB o x()
 **  \ para m[in]    pixa
 *\ pa r am[in]    box * \pa ra m [i n ]    co pyflag   L_ INSER T , L_COP Y ,L _ C LON E 
 * \return 0 if OK, 1o n e rror
*/ 
l_ o k
pixa AddBo x( P IXA     *pixa,          BO X    * box,
        l_int 32 co pyfl a g) 
{ 
  P ROC N AM E(" p ixa AddBox") ;
   if  (!p i x a ) 
      re turnERROR_INT("pi xanotd efi ned",  proc Name ,1);
   if(!box )        returnERRO R_INT("bo x n ot  de fi ned", procNa me,  1) ;
    i f (copy f lag != L _ IN SERT && copyflag!=  L _ C OP Y && cop yflag! =  L _C L ONE)
     retu r n  ERRO R_IN T (" invalidcopyfl a g" ,procNam e,  1);
   b oxa AddBo x (pix a->box a, box,copyf l ag);
    retur n  0;
}


/*!
*  \ b r ie f    p ixa ExtendArray ()
* 
 *\par a m[ in]    pi xa
 *  \ r et u rn  0 if OK; 1 on e rr or
 * * <p re>
 * Notes: 
 *      ( 1 ) Doublesthes iz e  of the pixa a nd bo xa ptr arr a ys.
 * < /pre> 
 */
sta tic l_int 3 2 
pixaExt end Arr ay( PIX A  * pixa)
{
    P R O CNAM E( "pixaEx ten dArray" );
   i f ( !p ixa)
       retu rn  E RR OR _IN T("pi x a not de fi ned ",  pr ocNam e , 1);
   retu rn  p i xaE xtendAr r ay T o Size (p ix a, 2  *pi xa->n allo c );}


/*! 
 * \brie f pixa Ex te ndArray ToSize()
 *
*\param[in]    p ixa
 * 
invalid copyflag",_procName, 1);
_   if_(!pixc)
 __ __  return_ERROR_INT("pixc not made",_procName, 1);

  _ n =_pixaGetCount(pixa);
_   if (n >= pixa->nalloc)
       _pixaExtendArray(pixa);
_ __pixa->pix[n]_= pixc;
   _pixa->n++;

    return_0;
}


/*!
 *_\brief   pixaAddBox()
 *
 * \param[in] __ pixa
 *_\param[in]    box
 * \param[in]  _ copyflag    L_INSERT,_L_COPY, L_CLONE
 *_\return__0 if OK, 1_on error
 */
l_ok
pixaAddBox(PIXA   _*pixa,
     _     BOX _   *box,
  _    _ _ l_int32  copyflag)
{
 _  PROCNAME("pixaAddBox");

_ _ if (!pixa)
_     _ return ERROR_INT("pixa_not defined", procName, 1);
  __if (!box)
 ___ _  return_ERROR_INT("box_not defined",_procName,_1);
    if (copyflag!=_L_INSERT_&& copyflag!= L_COPY && copyflag!= L_CLONE)
 _   __ return ERROR_INT("invalid copyflag",_procName, 1);

   _boxaAddBox(pixa->boxa, box, copyflag);
   _return 0;
}


/*!
_* \brief_  pixaExtendArray()
 *
 * \param[in]    pixa
 *_\return  0 if OK; 1_on error
 *
 *_<pre>
 *_Notes:
_*  __ _(1) Doubles the size of the pixa_and boxa_ptr arrays.
 * </pre>
 */
static l_int32
pixaExtendArray(PIXA_ *pixa)
{
  __PROCNAME("pixaExtendArray");

    if (!pixa)
_     _ return ERROR_INT("pixa not defined",_procName,_1);

_   return pixaExtendArrayToSize(pixa,_2 * pixa->nalloc);
}


/*!
 * \brief _ pixaExtendArrayToSize()
 *
_* \param[in]    pixa
 *