FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour ayuda con error en compilacion de un archivo en c
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
ayuda con error en compilacion de un archivo en c
Posted: Mon Jul 12, 2010 09:20 PM
Compañeros, me podrian ayudar con la compilación de este archivo
me da este error:

hasta hace poco compilaba perfecto con el xharbour nov2009, pero con el nuevo de jun2010
falla.

Code (fw): Select all Collapse
Proyecto: factura, Entorno: xhbdotcom:
[1]:xhb.Exe /m /n /gc0 /w0 /es0 /a /iinclude;d:\fwh\include;d:\fwh\includex /iD:\xhb\Include /q0 /d__XHARBOUR__ /iD:\xhb\c_include;D:\xhb\c_include\win  source\inv.prg /d__XHARBOUR__ /d__FLAT__ /oObj\inv.c
Generating object output to 'Obj\inv.obj'...
[1]:xcc.exe -FoObj\strfmt.Obj -Ot -D__XHARBOUR__ -D__FLAT__ -D__XHARBOUR__   -Iinclude;d:\fwh\include;d:\fwh\includex -I"D:\FWH\INCLUDE"  -I"D:\FWH\INCLUDEX"  -Iinclude  -ID:\xhb\Include  -ID:\xhb\c_include  -ID:\xhb\c_include\win  -ID:\xhb\c_include\msvc source\strfmt.c
source\strfmt.c(59): error: Operands of = have illegal types 'char *' and 'const char *'.
source\strfmt.c(85): error: Operands of = have illegal types 'char *' and 'const char *'.


Code (fw): Select all Collapse
/*
 * $Id: strfmt.c,v 1.1 2005/10/13 12:01:10 lf_sfnet Exp $
 */

/*
 * Harbour Project source code:
 * STRFORMAT() function
 *
 * Copyright 1999-2001 Viktor Szakats <viktor.szakats@syenar.hu>
 * www - <!-- m --><a class="postlink" href="http://www.harbour-project.org">http://www.harbour-project.org</a><!-- m -->
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this software; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307 USA (or visit the web site <!-- m --><a class="postlink" href="http://www.gnu.org/">http://www.gnu.org/</a><!-- m -->).
 *
 * As a special exception, the Harbour Project gives permission for
 * additional uses of the text contained in its release of Harbour.
 *
 * The exception is that, if you link the Harbour libraries with other
 * files to produce an executable, this does not by itself cause the
 * resulting executable to be covered by the GNU General Public License.
 * Your use of that executable is in no way restricted on account of
 * linking the Harbour library code into it.
 *
 * This exception does not however invalidate any other reasons why
 * the executable file might be covered by the GNU General Public License.
 *
 * This exception applies only to the code released by the Harbour
 * Project under the name Harbour.  If you copy code from other
 * Harbour Project or Free Software Foundation releases into a copy of
 * Harbour, as the General Public License permits, the exception does
 * not apply to the code that you add in this way.  To avoid misleading
 * anyone as to the status of such modified files, you must delete
 * this exception notice from them.
 *
 * If you write modifications of your own for Harbour, it is your choice
 * whether to permit this exception to apply to your modifications.
 * If you do not wish that, delete this exception notice.
 *
 */

#include "hbapi.h"

#define HB_STRFORMAT_PARNUM_MAX_ 9

HB_FUNC( STRFORMAT )
{
   char* pszMask = hb_parcx(1);
   ULONG nMaskLen = hb_parclen(1);
   ULONG nMaskPos;
   ULONG nParNum = hb_pcount();
   ULONG nLenTable [HB_STRFORMAT_PARNUM_MAX_];
   char* pszVarTable [HB_STRFORMAT_PARNUM_MAX_];

   ULONG nRetValLen;
   char* pszRetVal;
   char* pszRetValSave;

   ULONG tmp;

   if (nParNum < 1)
   {
      hb_retc("");
      return;
   }

   nParNum--;

   if (nParNum > HB_STRFORMAT_PARNUM_MAX_) nParNum = HB_STRFORMAT_PARNUM_MAX_;

   for (tmp = 0; tmp < nParNum; tmp++)
   {
      nLenTable[tmp] = hb_parclen(tmp + 2);
      pszVarTable[tmp] = hb_parcx(tmp + 2);
   }

   nMaskPos = 0;

   nRetValLen = 0;
   while (nMaskPos < nMaskLen)
   {
      if (pszMask[nMaskPos] == '%')
      {
         nMaskPos++;

         if (pszMask[nMaskPos] == '\0')
         {
            break;
         }
         else if (pszMask[nMaskPos] == '%')
         {
            nRetValLen++;
         }
         else if (pszMask[nMaskPos] >= '1' && pszMask[nMaskPos] <= (int)(nParNum + '0'))
         {
            nRetValLen += nLenTable[pszMask[nMaskPos] - '1'];
         }
         else
         {
            /* ; do nothing */
         }
      }
      else
      {
         nRetValLen++;
      }

      nMaskPos++;
   }

   nMaskPos = 0;

   pszRetVal = pszRetValSave = (char *) hb_xgrab(nRetValLen + 1);
   while (nMaskPos < nMaskLen)
   {
      if (pszMask[nMaskPos] == '%')
      {
         nMaskPos++;

         if (pszMask[nMaskPos] == '\0')
         {
            break;
         }
         else if (pszMask[nMaskPos] == '%')
         {
            *pszRetVal++ = pszMask[nMaskPos];
         }
         else if (pszMask[nMaskPos] >= '1' && pszMask[nMaskPos] <= (int)(nParNum + '0'))
         {
            ULONG nPos = pszMask[nMaskPos] - '1';

            memcpy(pszRetVal, pszVarTable[nPos], nLenTable[nPos]);
            pszRetVal += nLenTable[nPos];
         }
         else
         {
            /* ; do nothing */
         }
      }
      else
      {
         *pszRetVal++ = pszMask[nMaskPos];
      }

      nMaskPos++;
   }

   hb_retclen(pszRetValSave, nRetValLen);

   hb_xfree(pszRetValSave);
}
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 71
Joined: Fri Jan 11, 2008 06:55 AM
Re: ayuda con error en compilacion de un archivo en c
Posted: Mon Jul 19, 2010 03:52 PM
Carlos,

es sencillo de arreglar,
Code (fw): Select all Collapse
59: char* pszMask = (char *) hb_parcx(1);

85: pszVarTable[tmp] = (char *) hb_parcx(tmp + 2);


Saludos,

Andres Reyes
{{{ ---- xharbour + Borland C --- }}}

Continue the discussion