Compilar bit.c Ayuda

Compilar bit.c Ayuda

Postby ruben Dario » Wed Dec 03, 2014 2:05 am

Saludos,
Cual es el error de este código , no me crea el obj

Code: Select all  Expand view  RUN

/*******************************************************************************
* Program Id: bit.c
*    Version: 1.00
********************************************************************************
*
* Purpose: Sets the given bit in a passed bit string.  Returns the previous
*          value.  Be sure to pass the string by reference.  NOTE.  In order
*          to stay as fast as possible, minimal parameter checking is
*          performed.  It is up to the user to not be too stupid.
*
* Syntax:  bit( <OptC String>, <OptN (1...n) Offset> [, <OptL Set/Clear>] )
*
********************************************************************************
#include <extend.h>

CLIPPER bit( void )
{
   unsigned char   mask,
                  *ptr;
   unsigned int    loc,
                   offset = _parni( 2 ) - 1,
                   res    = 0;

   loc = offset / 8;
   if ( loc < _parclen( 1 ) )
   {
      ptr = _parc( 1 ) + loc;
      loc = offset % 8;
      res = *ptr << loc & 0x80;

      if ( PCOUNT > 2 )
      {
         mask = (unsigned char ) 0x80 >> loc;
         if ( _parl( 3 ) )
            *ptr = *ptr | mask;
         else
            *ptr = *ptr & ~mask;
      }
   }
   _retl( res );
}





y

Code: Select all  Expand view  RUN


/*
 * ieereal.c
 *
 * callable from Clipper only (S'87 or 5.0)
 *
 * syntax:   ieereal( nIEEVar )
 * returns:  char string of length 8.  each char in string represents
 *           the appropriate byte of nIEEVar.
 *
 * syntax:   realiee( cIEEStr )
 * returns:  double.  converts cIEEStr to it's double equivalent
 *
 * compile:  msc 5.1 -- cl /W3 /Ox /AL /Gs /c /FPa /Zl ieereal.c
 *
 */



#include "extend.h"

/*
   CLIPPER ieereal(void);
   CLIPPER realiee(void);

*/



union {
        double n;
        char   s[8];
      } v;

/*
 * purpose:  to convert a Clipper numeric to spreadsheet format
 * syntax:   ieereal( nValue )
 * returns:  char string of length 8.  each char in string represents
 *           the appropriate byte of nIEEVar.
 */

CLIPPER ieereal()
{
    double n;

    n = _parnd(1);

    _retclen( (char far *) &n, 8);
}

/*
 * purpose:  to convert a spreadsheet string into its numeric value
 * syntax:   realiee( cIEEStr )
 * returns:  nValue
 */


CLIPPER realiee()
{
    char i;
    char far *t;

    t = _parc(1);

    for (i = 0; i < 8; i++)
        v.s[i] = *t++;

    _retnd( v.n );
}
 
Ruben Dario Gonzalez
Cali-Colombia
rubendariogd@hotmail.com - rubendariogd@gmail.com
User avatar
ruben Dario
 
Posts: 1070
Joined: Thu Sep 27, 2007 3:47 pm
Location: Colombia

Re: Compilar bit.c Ayuda

Postby Antonio Linares » Wed Dec 03, 2014 10:39 am

Ruben,

Si lo que quieres es comprobar un determinado bit FWH tiene lAnd( nValor1, nValor2 ) --> lOnOff y tambien nAnd( nValor1, nValor2 ) --> nValor

http://wiki.fivetechsoft.com/doku.php?id=fivewin_funcion_land

http://wiki.fivetechsoft.com/doku.php?id=fivewin_funcion_nand

Y Harbour si mal no recuerdo tambien proporciona una función para comprobar los Bits. Seguramente algún usuario nos podrá ayudar a recordarla :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 58 guests