#include "Bdef.h"

#if (INTFACE == C_CALL)
int Cblacs_pnum(ConTxt, prow, pcol)
int  ConTxt;
int  prow;
int  pcol;
#else
int blacs_pnum_(ConTxt, prow, pcol)
int  *ConTxt;
int  *prow;
int  *pcol;
#endif
{
   BLACSCONTEXT *ctxt;

   MGetConTxt(Mpval(ConTxt), ctxt);
   if ( (Mpval(prow) >= 0) && (Mpval(prow) < ctxt->nprow) &&
        (Mpval(pcol) >= 0) && (Mpval(pcol) < ctxt->npcol) )
      return( Mkpnum(ctxt, Mpval(prow), Mpval(pcol)) );
   else return(-1);
}
