cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Building with BCC (Was: Newbie Proglem with Compile)

From: <Medsyntel_at_aol.com>
Date: Wed, 12 Jan 2011 00:27:00 -0500 (EST)

Hi:
 
    (I'm the Newbie).
 
    I determined that, altho I could finally compile the 90-odd libcurl .c
files, and then link them with my xHarbour language program (see
_www.xharbour.org_ (http://www.xharbour.org) and _www.xharbour.com_
(http://www.xharbour.com) and the ng comp.lang.xharbour), that the .c programs already
used in xHarbour low-level routines are strikingly different than those in
libcurl :((
 
    Such that, unfortunately, I have to creep off to my newbie cage, and
try to learn the native tIP classes that are part of xHarbour.
 
    Below is a short example of a .c program that is compiled and linked
into our RunTime Library (RTL). It is the module that transforms a numeric
vbl to a string with a set number of 'zeros' in front of it. I received no
encouragement whatsoever from the gurus in the xHarbour ng when I
suggested that we make libcurl a library for our own harbour language. They said
use our *own* tIP Classes.
 
So, thank you all ! (I'm way over my head here.)
 
-Mel Smith
 
***********************************************
#include "hbapi.h"
#include "hbapiitm.h"
#include "hbfast.h"
#include "hbapierr.h"
 
HB_FUNC( STRZERO )
{
if( hb_pcount() >= 1 && hb_pcount() <= 3 )
{
BOOL bValid;
PHB_ITEM pNumber = hb_param( 1, HB_IT_NUMERIC );
PHB_ITEM pWidth = NULL;
PHB_ITEM pDec = NULL;
 
      if( pNumber )
{
bValid = TRUE;
 
         if( hb_pcount() >= 2 )
{
pWidth = hb_param( 2, HB_IT_NUMERIC );
if( !pWidth )
bValid = FALSE;
}
 
         if( hb_pcount() >= 3 )
{
pDec = hb_param( 3, HB_IT_NUMERIC );
if( !pDec )
bValid = FALSE;
}
}
else
bValid = FALSE;
 
      if( bValid )
{
char * szResult = hb_itemStr( pNumber, pWidth, pDec );
 
         if( szResult )
{
ULONG ulPos = 0;
 
            while( szResult[ ulPos ] != '\0' && szResult[ ulPos ] != '-' )
ulPos++;
 
            if( szResult[ ulPos ] == '-' )
{
/* NOTE: Negative sign found, put it to the first position */
 
                szResult[ ulPos ] = ' ';
 
                ulPos = 0;
while( szResult[ ulPos ] != '\0' && szResult[ ulPos ] == ' ' )
szResult[ ulPos++ ] = '0';
 
                szResult[ 0 ] = '-';
}
else
{
/* Negative sign not found */
 
                ulPos = 0;
while( szResult[ ulPos ] != '\0' && szResult[ ulPos ] == ' ' )
szResult[ ulPos++ ] = '0';
}
 
             hb_retcAdopt( szResult );
}
else
{
hb_retc( "" );
}
}
else
{
#ifdef HB_C52_STRICT
/* NOTE: In CA-Cl*pper STRZERO() is written in Clipper, and will call
STR() to do the job, the error (if any) will also be thrown
by STR(). [vszakats] */
hb_errRT_BASE_SubstR( EG_ARG, 1099, NULL, "STR", 3, hb_paramError( 1 ),
hb_paramError( 2 ), hb_paramError( 3 ) );
#else
hb_errRT_BASE_SubstR( EG_ARG, 9999, NULL, "STRZERO", 3, hb_paramError( 1 ),
 hb_paramError( 2 ), hb_paramError( 3 ) );
#endif
}
}
}

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-01-12