Ejemplo n.º 1
0
static HB_BOOL hb_mlInit( PHB_MLC_INFO pMLC, int iParAdd )
{
   HB_ISIZ nSize = hb_parnsdef( 2, 79 );

   pMLC->pszString = hb_parc( 1 );
   if( pMLC->pszString && nSize > 0 )
   {
      pMLC->nOffset = pMLC->nMaxCol = pMLC->nMaxPos = pMLC->nCol = 0;

      pMLC->nLineLength = nSize;
      pMLC->nLen = hb_parclen( 1 );

      pMLC->nTabSize = hb_parnsdef( 3 + iParAdd, 4 );
      pMLC->fWordWrap = hb_parldef( 4 + iParAdd, 1 );

#ifdef HB_CLP_STRICT
      if( pMLC->nLineLength > 254 )
         pMLC->nLineLength = 79;
#endif
      if( pMLC->nTabSize >= pMLC->nLineLength )
         pMLC->nTabSize = pMLC->nLineLength - 1;
      if( pMLC->nTabSize == 0 )
         pMLC->nTabSize = 1;

      pMLC->cdp = hb_vmCDP();
      if( ! HB_CDP_ISCHARIDX( pMLC->cdp ) )
         pMLC->cdp = NULL;

      hb_mlGetEOLs( pMLC, 5 + iParAdd );
      return HB_TRUE;
   }

   return HB_FALSE;
}
Ejemplo n.º 2
0
static char * hb_mlGetParams( int iParAdd, ULONG * pulLen, ULONG * pulLineLength,
                              ULONG * pulTabSize, BOOL * pfWordWrap,
                              PHB_EOL_INFO * pEOLs, int * piEOLs )
{
   char * pszString = hb_parc( 1 );
   if( pszString )
   {
      if( ISNUM( 2 ) )
      {
         if( hb_parnd( 2 ) <= 0 )
            return NULL;
         * pulLineLength = hb_parnl( 2 );
      }
      else
         * pulLineLength = 79;
      * pulLen = hb_parclen( 1 );
      * pulTabSize = ISNUM( 3 + iParAdd ) ? hb_parnl( 3 + iParAdd ) : 4;
      * pfWordWrap = ISLOG( 4 + iParAdd ) ? hb_parl( 4 + iParAdd ) : TRUE;
      * pEOLs = hb_mlGetEOLs( 5 + iParAdd, piEOLs );
#ifdef HB_C52_STRICT
      if( * pulLineLength > 254 )
         * pulLineLength = 79;
#endif
      if( * pulTabSize >= * pulLineLength )
         * pulTabSize = * pulLineLength - 1;
      else if( * pulTabSize == 0 )
         * pulTabSize = 1;
   }
   return pszString;
}