CLIPPER setdrive()
{
    if (! (PCOUNT==1 || ISNUM(1)))
        _retni(0);
    else
        _retni(setdisk(_parni(1)));
}
Exemple #2
0
/*****************************************************************************
  Syntax:

    CLOSE_DEV( <device_name> )

  Parameters:

    <device_name> - a numeric value that corresponds to the desired POS device.
                    See symbolic constants defined in PFL_CLIP.CH.
                
  Description:
    CLOSE_DEV() terminates or closes the communication channel of the
    designated device.

  Return values:
    
    Returns a numeric value describing the result of the process. 

    NORMAL        - Normal operation
    DEV_NOT_EXIST - Device not initialized
    INVP          - Invalid parameter or invalid command    

    See header file - PFL_CLIP.CH for details.
     
  rnr  4-19-94  
*****************************************************************************/
CLIPPER close_dev(void)
{
  int gen_status = NORMAL;       /* generic error codes returned to the application */
  int dev_no;                    /* device no */

  /* validate parameters */
  if (PCOUNT == 1 && ISNUM(DEV_NUM))
  {
    dev_no = _parni(DEV_NUM);    /* get device name */

    /* verify if the requested device is supported */
    if ( dev_no < FALSE ||  dev_no > NO_OF_DEVICES )
    {
      _retni(INVP);              /* device not yet supported */
      return;
    }    

    /* determine termination method */
    switch (pos_setup[dev_no].open_method)  
    {
      case 1: gen_status = close_method1(dev_no);  /* file method */
              break;
      case 2: gen_status = close_method2(dev_no);  /* file method but check existing device(s) */
              break;
      case 3: gen_status = close_method3(dev_no);  /* direct or other method */
              break;
    }    

    _retni(gen_status);
  }
  else
    _retni(INVP);
}
CLIPPER portin()
{
    if (! (PCOUNT==1 || ISNUM(1)))
        _retni(0);
    else
        _retni((int)inportb(_parni(1)));
}
CLIPPER randomic()
{
    if (! (PCOUNT==1 || ISNUM(1)))
        _retni(0);
    else
        _retni(random(_parni(1)));
}
Exemple #5
0
CLIPPER gScrnRest(void)
{
  /** Define C-variables to hold Clipper parameters **/

  int iLeft, iTop;                          /* Upper left corner of screen region to save */
  char *cScrFile;        	            /* Screen Swap file */
  int image_ops;                            /* Put image operation */
  int iDelFlag;                             /* Delete Swap file flag */
  int iMoveFlag;                            /* Optional Row & Column movement parameter*/
  

  int status;                               /* return value */


  if (PCOUNT < 3)            		    /* Check parameters */
     {
       _retni(grSCR_BADPARAM);
       return;
     }

  /** Assign Default **/
  image_ops = COPY_PUT;
  iDelFlag  = TRUE;
  iMoveFlag = MSCALE;


  /** Assign Clipper parameters to C-data types **/

  iLeft   = _parni(1);
  iTop    = _parni(2);
  cScrFile = _parc(3);

  if(ISNUM(4))
     image_ops = _parni(4);

  if(ISNUM(5))
     iDelFlag = _parni(5);

  if(ISNUM(6))
     iMoveFlag = _parni(6);

  status =  cScrnRest( iLeft, iTop, cScrFile, image_ops, iDelFlag, iMoveFlag );


  _retni(status);

}
static void get_token()
{
    char * ptr ;
    unsigned int n ;

    while ( isspace( *token_ptr ) ) token_ptr++ ;

    if ( !*token_ptr )
    {
        token.type = NOTOKEN ;
        return ;
    }

    /* Numbers */

    if ( ISNUM( *token_ptr ) )
    {
        int num = 0 ;

        /* Calculate the number value */

        while ( ISNUM( *token_ptr ) ) num = num * 10 + ( *token_ptr++ - '0' ) ;
        token.type = NUMBER ;
        token.code = num ;
        snprintf( token.name, sizeof( token.name ), "%d", token.code ) ;
        return ;
    }

    ptr = token.name ;
    *ptr++ = TOUPPER( *token_ptr ) ;
    if ( ISWORDCHAR( *token_ptr++ ) )
        while ( ISWORDCHAR( *token_ptr ) ) *ptr++ = TOUPPER( *token_ptr++ ) ;
    *ptr = 0 ;

    for ( n = 0; n < dcb.data.NID; n++ )
    {
        if ( strcmp( (const char *)dcb.id[n].Name, token.name ) == 0 )
        {
            token.type = IDENTIFIER ;
            token.code = dcb.id[n].Code ;
            strcpy( token.name, (char *)dcb.id[n].Name ) ;
            return ;
        }
    }

    token.type = NOTOKEN ;
}
Exemple #7
0
/* give current player cards */
static int L_add_card(lua_State *L) {
	int i;
	CHECKARG(1); ISNUM(1);
	i=TONUM(1);
	if(i<0) error("%s: must draw nonnegative number of cards, not %d.\n",__func__+2,i);
	while(i--) drawcard(currentplayer);
	return 0;
}
Exemple #8
0
/* get group[i].iskingdom */
static int L_get_group_iskingdom(lua_State *L) {
	int i;
	CHECKARG(1); ISNUM(1);
	i=TONUM(1);
	if(i<0 || i>=groups) error("get_group_iskingdom: found %d, should be between 0 and %d.\n",i,groups-1);
	lua_pushnumber(L,group[i].iskingdom);
	return 1;
}
Exemple #9
0
/* set piles */
static int L_set_piles(lua_State *L) {
	int i;
	CHECKARG(1); ISNUM(1);
	i=TONUM(1);
	if(i<0) error("set_piles: found %d, should be nonnegative.\n",i);
	piles=i;
	return 0;
}
Exemple #10
0
static int L_get_player_playarean(lua_State *L) {
	int i;
	CHECKARG(1); ISNUM(1);
	i=TONUM(1);
	if(i<0 || i>=players) error("%s: illegal player number %d.\n",__func__+2,i);
	lua_pushnumber(L,player[i].playarean);
	return 1;
}
Exemple #11
0
/* get card[i].groupid */
static int L_get_card_groupid(lua_State *L) {
	int i;
	CHECKARG(1); ISNUM(1);
	i=TONUM(1);
	if(i<0 || i>=cards) error("get_card_groupid: found %d, should be between 0 and %d.\n",i,cards-1);
	lua_pushnumber(L,card[i].groupid);
	return 1;
}
Exemple #12
0
/* get card[i].fullname */
static int L_get_card_fullname(lua_State *L) {
	int i;
	CHECKARG(1); ISNUM(1);
	i=TONUM(1);
	if(i<0 || i>=cards) error("%s: found %d, should be between 0 and %d.\n",__func__+2,i,cards-1);
	lua_pushstring(L,card[i].fullname);
	return 1;
}
Exemple #13
0
/* given index, return cost of card in potions */
static int L_get_card_potion_cost(lua_State *L) {
	int id;
	CHECKARG(1); ISNUM(1);
	id=TONUM(1);
	if(id<0 || id>=cards) error("%s: illegal index %d.\n",__func__+2,id);
	lua_pushnumber(L,potion_cost_L(id));
	return 1;
}
Exemple #14
0
/* given index, return cost of card in money */
static int L_get_card_money_cost(lua_State *L) {
	int id;
	CHECKARG(1); ISNUM(1);
	id=TONUM(1);
	if(id<0 || id>=cards) error("get_card_money_cost: illegal index %d.\n",id);
	lua_pushnumber(L,money_cost_L(id));
	return 1;
}
Exemple #15
0
/* set all fields in pile to zero */
static int L_init_pile(lua_State *L) {
	int i;
	CHECKARG(1); ISNUM(1);
	i=TONUM(1);
	if(i<0 || i>=piles) error("init_pile: index %d out of bounds.\n",i);
	initpile(i);
	return 0;
}
Exemple #16
0
int utils_isnum(const char *str, int size) {
	const char *p = str;
	int i = size;

	while(i-- > 0 && *p != '\0') {
		if (!ISNUM(*p))
			return FALSE;
		p++;
	}
	return TRUE;
}
Exemple #17
0
static unsigned long _toul(const char *s)
{
  unsigned long res;
  unsigned long n;
  const char *p;
  for (p = s; *p; p++)
    if (!ISNUM(*p)) break;
  p--;
  res = 0;
  for (n = 1; p >= s; p--, n *= 10)
    res += (*p - '0') * n;
  return res;
}
Exemple #18
0
 CLIPPER  AMODPUBLIC( void ){
    WORD wModule,i,wPublics;
    if ((PCOUNT() >= 1) && ISNUM(1) && (wLib != 0xffff) && ((wModule=_parni(1)-1)  < wModules)){
       wPublics=ScanModPublics(wModule);
       if (wPublics > 0){
          _reta(wPublics);
          for(i=0;i <= wPublics; i++){
             _storc(pcStrings[i],-1,i+1);
          }
          FreeStrings(wPublics);
          return;
       }
       _ret();
       return;
    }
 }
Exemple #19
0
 CLIPPER  AMODEXTERN( void ){
    WORD wModule,i,wExternals;
    if ((PCOUNT() >= 1) && ISNUM(1) && (wLib != 0xffff) && ((wModule=_parni(1)-1)  < wModules)){
       wExternals=ScanModExternals(wModule);
       if (wExternals > 0){
          _reta(wExternals);
          for(i=0;i <= wExternals; i++){
             _storc(pcStrings[i],-1,i+1);
          }
          FreeStrings(wExternals);
          return;
       }
       _ret();
       return;
    }
 }
Exemple #20
0
CLIPPER JW_SCRAM(void)
{
    char *temp;
    char *str;
    unsigned int len;
    int i;
    char c;

    if ( PCOUNT == 2 && ISCHAR(1) && ISNUM(2))
	{
	/* get pointer to param */
	str = _parc(1);

	/* get strings length */
	len = _parclen(1);

	/* allocate temp buffer */
	temp = _xgrab(len+1);

	/* put null byte */
	temp[len] = '\0';

	/* get encrypting value */
	i = _parni(2);

	/* convert to char */
	c = (char)i;

	/* copy input string to buffer XORing and 2's complementing as we go */
	for (i = 0; i < len; i++)
	    {
	    temp[i] = ~(str[i] ^ c);
	    }
	/* post modified value as CLIPPER return */
	_retclen(temp, len);

	/* free buffer */
	_xfree(temp);
	}
    else
    {
	     /* bad param */
	     _ret();
    }
}
Exemple #21
0
static ULONG_PTR _toulptr(const TCHAR *s)
{
    ULONG_PTR res;
    ULONG_PTR n;
    const TCHAR *p;

    for (p = s; *p; p++)
        if (!ISNUM(*p))
            break;

    p--;
    res = 0;

    for (n = 1; p >= s; p--, n *= 10)
        res += (*p - '0') * n;

    return res;
}
Exemple #22
0
CLIPPER set_dev(void)
{
  int gen_status = NORMAL;       /* generic error codes returned to the application */
  int dev_no;                    /* device no */

  /* validate parameters */
  if (PCOUNT == 1 && ISNUM(DEV_NUM))
  {
    dev_no = _parni(DEV_NUM);    /* get device name */

    /* verify if the requested device is supported */
    if ( dev_no < 0 || dev_no > NO_OF_DEVICES )
    {
      _retni(INVP);              /* device not yet supported */
      return;
    }

    /* verify initial status */
    if ( pos_setup[dev_no].init_flag )
    {
      _retni(DEV_EXIST);   /* device already initialized */
      return;
    }

    /* initialize device */
    switch (pos_setup[dev_no].open_method)  /* determine initialization method */
    {
      case 1: gen_status = init_method1(dev_no);  /* file method */
              break;
      case 2: gen_status = init_method2(dev_no);  /* file method but check existing device(s) */
              break;
      case 3: gen_status = init_method3(dev_no);  /* direct or other method */
              break;
    }

    /* perform additional hardware checking or initialization */
    if (pos_setup[dev_no].device_check && gen_status == NORMAL)
      gen_status = pos_device_chk(dev_no);

    _retni(gen_status);
  }
  else
    _retni(INVP);
}
Exemple #23
0
CLIPPER veri_init()
{

  int status;
  unsigned char baud_rate, parity, stop_bit, data_bit, protocol;

  if  (PCOUNT == 1 && ISNUM(PORT_NUM))
  {
    port_no = _parni(PORT_NUM);
    
    baud_rate = BR_9600;
    parity = P_EVEN;
    stop_bit = SB_1;
    data_bit = DB_7;    
    protocol = 0;

    status = pfl_com_init(port_no, (baud_rate | parity | stop_bit | data_bit), protocol);

    _retni(status);
  }
  else
    _retni(INVP);
}  
/*
 * Simple routine to parse an ascii DECnet address
 * into a network order address.
 */
static int parse_addr(__le16 *addr, char *str)
{
	__u16 area, node;

	while(*str && !ISNUM(*str)) str++;

	if (*str == 0)
		return -1;

	area = (*str++ - '0');
	if (ISNUM(*str)) {
		area *= 10;
		area += (*str++ - '0');
	}

	if (*str++ != '.')
		return -1;

	if (!ISNUM(*str))
		return -1;

	node = *str++ - '0';
	if (ISNUM(*str)) {
		node *= 10;
		node += (*str++ - '0');
	}
	if (ISNUM(*str)) {
		node *= 10;
		node += (*str++ - '0');
	}
	if (ISNUM(*str)) {
		node *= 10;
		node += (*str++ - '0');
	}

	if ((node > 1023) || (area > 63))
		return -1;

	if (INVALID_END_CHAR(*str))
		return -1;

	*addr = cpu_to_le16((area << 10) | node);

	return 0;
}
Exemple #25
0
bool bpx_is_float(TERM t)
{
    XDEREF(t);
    return ISNUM(t);
}
Exemple #26
0
/* helper function */
static void do_atnum( int iSwitch )
{
   if( ( ISCHAR( 1 ) ) && ( ISCHAR( 2 ) ) )
   {
      const char *   pcStringToMatch   = hb_parc( 1 );
      HB_SIZE        sStrToMatchLen    = hb_parclen( 1 );
      const char *   pcString          = hb_parc( 2 );
      HB_SIZE        sStrLen           = hb_parclen( 2 );
      int            iMultiPass        = ct_getatmupa();
      int            iAtLike           = ct_getatlike();
      char           cAtLike           = ct_getatlikechar();
      HB_SIZE        sIgnore, sMatchStrLen = 0;
      ULONG          ulCounter;
      const char *   pc                = NULL;

      /* eventually ignore some characters */
      if( ISNUM( 4 ) )
         sIgnore = ( size_t ) hb_parnl( 4 );
      else
         sIgnore = 0;

      if( sIgnore >= sStrLen )
      {
         switch( iSwitch )
         {
            case DO_ATNUM_AFTERATNUM:
            {
               /* AFTERATNUM */
               int iArgErrorMode = ct_getargerrormode();
               if( iArgErrorMode != CT_ARGERR_IGNORE )
               {
                  ct_error( ( USHORT ) iArgErrorMode, EG_ARG, CT_ERROR_AFTERATNUM,
                            NULL, "AFTERATNUM", 0, EF_CANDEFAULT, 4,
                            hb_paramError( 1 ), hb_paramError( 2 ),
                            hb_paramError( 3 ), hb_paramError( 4 ) );
               }
               ;
               hb_retc( "" );
            }; break;

            case DO_ATNUM_BEFORATNUM:
            {
               /* BEFORATNUM */
               int iArgErrorMode = ct_getargerrormode();
               if( iArgErrorMode != CT_ARGERR_IGNORE )
               {
                  ct_error( ( USHORT ) iArgErrorMode, EG_ARG, CT_ERROR_BEFORATNUM,
                            NULL, "BEFORATNUM", 0, EF_CANDEFAULT, 4,
                            hb_paramError( 1 ), hb_paramError( 2 ),
                            hb_paramError( 3 ), hb_paramError( 4 ) );
               }
               ;
               hb_retc( "" );
            }; break;

            case DO_ATNUM_ATNUM:
            {
               /* ATNUM */
               int iArgErrorMode = ct_getargerrormode();
               if( iArgErrorMode != CT_ARGERR_IGNORE )
               {
                  ct_error( ( USHORT ) iArgErrorMode, EG_ARG, CT_ERROR_ATNUM,
                            NULL, "ATNUM", 0, EF_CANDEFAULT, 4,
                            hb_paramError( 1 ), hb_paramError( 2 ),
                            hb_paramError( 3 ), hb_paramError( 4 ) );
               }
               ;
               hb_retnl( 0 );
            }; break;
         }

         return;
      }
      else
      {
         pcString += sIgnore;
         sStrLen  -= sIgnore;
      }

      /* nth match or last match ? */
      if( ISNUM( 3 ) && ( ( ulCounter = hb_parnl( 3 ) ) != 0 ) )
      {
         /* find the <ulCounter>th match */
         const char *   pcSubStr;
         HB_SIZE        sSubStrLen;
         ULONG          ulMatchCounter = 0;

         pcSubStr    = pcString;
         sSubStrLen  = sStrLen;

         while( ulMatchCounter < ulCounter )
         {
            switch( iAtLike )
            {
               case CT_SETATLIKE_EXACT:
               {
                  pc = ct_at_exact_forward( pcSubStr, sSubStrLen,
                                            pcStringToMatch, sStrToMatchLen,
                                            &sMatchStrLen );
               }; break;

               case CT_SETATLIKE_WILDCARD:
               {
                  pc = ct_at_wildcard_forward( pcSubStr, sSubStrLen,
                                               pcStringToMatch, sStrToMatchLen,
                                               cAtLike, &sMatchStrLen );
               }; break;

               default:
               {
                  pc = NULL;
               };
            }

            if( pc == NULL )
            {
               /* no match found; if this happens at this point,
                  there are no <ulCounter> matches, so return an empty string */
               switch( iSwitch )
               {
                  case DO_ATNUM_AFTERATNUM:
                  case DO_ATNUM_BEFORATNUM:
                  {
                     /* AFTERATNUM */
                     /* BEFORATNUM */
                     hb_retc( "" );
                  }; break;

                  case DO_ATNUM_ATNUM:
                  {
                     /* ATNUM */
                     hb_retnl( 0 );
                  }; break;
               }

               return;
            }

            ulMatchCounter++;

            if( iMultiPass )
               pcSubStr = pc + 1;
            else
               pcSubStr = pc + sMatchStrLen;
            sSubStrLen = sStrLen - ( pcSubStr - pcString );
         }

      }
      else /* (ISNUM (3) && ((ulCounter = hb_parnl (3)) != 0) */
      {
         /* we have to find the last match and return the
            string after that last match */

         switch( iAtLike )
         {
            case CT_SETATLIKE_EXACT:
            {
               pc = ct_at_exact_backward( pcString, sStrLen,
                                          pcStringToMatch, sStrToMatchLen,
                                          &sMatchStrLen );
            }; break;

            case CT_SETATLIKE_WILDCARD:
            {
               pc = ct_at_wildcard_backward( pcString, sStrLen,
                                             pcStringToMatch, sStrToMatchLen,
                                             cAtLike, &sMatchStrLen );
            }; break;

            default:
            {
               pc = NULL;
            };
         }

         if( pc == NULL )
         {
            /* no matches found */
            switch( iSwitch )
            {
               case DO_ATNUM_AFTERATNUM:
               case DO_ATNUM_BEFORATNUM:
               {
                  /* AFTERATNUM */
                  /* BEFORATNUM */
                  hb_retc( "" );
               }; break;

               case DO_ATNUM_ATNUM:
               {
                  /* ATNUM */
                  hb_retnl( 0 );
               }; break;
            }

            return;
         }

      }

      switch( iSwitch )
      {
         case DO_ATNUM_AFTERATNUM:
         {
            /* AFTERATNUM */
            if( pc + sMatchStrLen >= pcString + sStrLen )
               hb_retc( "" );
            else
               hb_retclen( pc + sMatchStrLen, sStrLen - ( pc + sMatchStrLen - pcString ) );
         }; break;

         case DO_ATNUM_BEFORATNUM:
         {
            /* BEFORATNUM */
            hb_retclen( pcString - sIgnore, pc - ( pcString - sIgnore ) );
         }; break;

         case DO_ATNUM_ATNUM:
         {
            /* ATNUM */
            hb_retns( pc - ( pcString - sIgnore ) + 1 );
         }; break;
      }

   }
   else /* ((ISCHAR (1)) && (ISCHAR (2))) */
   {
      switch( iSwitch )
      {
         case DO_ATNUM_AFTERATNUM:
         case DO_ATNUM_BEFORATNUM:
         {
            /* AFTERATNUM */
            PHB_ITEM pSubst         = NULL;
            int      iArgErrorMode  = ct_getargerrormode();
            if( iArgErrorMode != CT_ARGERR_IGNORE )
            {
               pSubst = ct_error_subst( ( USHORT ) iArgErrorMode, EG_ARG,
                                        ( iSwitch == DO_ATNUM_AFTERATNUM ? CT_ERROR_AFTERATNUM : CT_ERROR_BEFORATNUM ),
                                        NULL,
                                        ( iSwitch == DO_ATNUM_AFTERATNUM ? "AFTERATNUM" : "BEFORATNUM" ),
                                        0, EF_CANSUBSTITUTE, 4,
                                        hb_paramError( 1 ), hb_paramError( 2 ),
                                        hb_paramError( 3 ), hb_paramError( 4 ) );
            }

            if( pSubst != NULL )
            {
               hb_itemRelease( hb_itemReturnForward( pSubst ) );
            }
            else
            {
               hb_retc( "" );
            }
         }; break;

         case DO_ATNUM_ATNUM:
         {
            /* ATNUM */
            PHB_ITEM pSubst         = NULL;
            int      iArgErrorMode  = ct_getargerrormode();
            if( iArgErrorMode != CT_ARGERR_IGNORE )
            {
               pSubst = ct_error_subst( ( USHORT ) iArgErrorMode, EG_ARG, CT_ERROR_ATNUM,
                                        NULL, "ATNUM", 0, EF_CANSUBSTITUTE, 4,
                                        hb_paramError( 1 ), hb_paramError( 2 ),
                                        hb_paramError( 3 ), hb_paramError( 4 ) );
            }

            if( pSubst != NULL )
            {
               hb_itemRelease( hb_itemReturnForward( pSubst ) );
            }
            else
            {
               hb_retnl( 0 );
            }
         }; break;
      }
   }
}
Exemple #27
0
/* helper function for the justxxx() functions */
static void do_justify( int iSwitch )
{
   int iNoRet;

   iNoRet = ct_getref() && ISBYREF( 1 );

   if( ISCHAR( 1 ) )
   {
      const char * pcString = hb_parc( 1 );
      HB_SIZE      sStrLen  = hb_parclen( 1 );
      char         cJustChar;
      const char * pc;
      char *       pcRet, * pcw;
      HB_SIZE      sJustOffset;

      if( sStrLen == 0 )
      {
         if( iNoRet )
            hb_ret();
         else
            hb_retc_null();
         return;
      }

      if( hb_parclen( 2 ) > 0 )
         cJustChar = *( hb_parc( 2 ) );
      else if( ISNUM( 2 ) )
         cJustChar = ( char ) ( hb_parnl( 2 ) % 256 );
      else
         cJustChar = 0x20;

      pcRet = ( char * ) hb_xgrab( sStrLen + 1 );

      switch( iSwitch )
      {
         case DO_JUSTIFY_JUSTLEFT:
            pc          = pcString;
            sJustOffset = 0;
            while( ( *pc == cJustChar ) && ( pc < pcString + sStrLen ) )
            {
               sJustOffset++;
               pc++;
            }
            hb_xmemcpy( pcRet, pcString + sJustOffset, (size_t) ( sStrLen - sJustOffset ) );
            for( pcw = pcRet + sStrLen - sJustOffset; pcw < pcRet + sStrLen; pcw++ )
            {
               *pcw = cJustChar;
            }
            break;

         case DO_JUSTIFY_JUSTRIGHT:
            pc          = pcString + sStrLen - 1;
            sJustOffset = 0;
            while( ( *pc == cJustChar ) && ( pc >= pcString ) )
            {
               sJustOffset++;
               pc--;
            }
            for( pcw = pcRet; pcw < pcRet + sJustOffset; pcw++ )
            {
               *pcw = cJustChar;
            }
            hb_xmemcpy( pcRet + sJustOffset, pcString, (size_t) ( sStrLen - sJustOffset ) );
            break;
      }

      if( ISBYREF( 1 ) )
         hb_storclen( pcRet, sStrLen, 1 );

      if( iNoRet )
      {
         hb_ret();
         hb_xfree( pcRet );
      }
      else
         hb_retclen_buffer( pcRet, sStrLen );
   }
   else  /* ISCHAR( 1 ) */
   {
      PHB_ITEM pSubst         = NULL;
      int      iArgErrorMode  = ct_getargerrormode();

      if( iArgErrorMode != CT_ARGERR_IGNORE )
      {
         pSubst = ct_error_subst( ( USHORT ) iArgErrorMode, EG_ARG,
                                  iSwitch == DO_JUSTIFY_JUSTLEFT ?
                                  CT_ERROR_JUSTLEFT : CT_ERROR_JUSTRIGHT,
                                  NULL, HB_ERR_FUNCNAME, 0,
                                  EF_CANSUBSTITUTE, HB_ERR_ARGS_BASEPARAMS );
      }

      if( pSubst != NULL )
         hb_itemReturnRelease( pSubst );
      else if( iNoRet )
         hb_ret();
      else
         hb_retc_null();
   }
}
Exemple #28
0
//---------------------------------------------------------------------------//
CLIPPER WBRWPANE( void ) // ( hWnd, hDC, Self, bLine, aSizes, nFirstItem,
                           //   nClrFore, nClrBack, hFont, aJustify, nStyle
                           //   lCellStyle, lFocused ) -> nRowsSkipped
                           //   bTextColor, bBkColor, nClrLine, nColorFondo, bFont ) // New's by CesoTech
{
   HWND hWnd        = ( HWND ) _parnl( 1 );
   HDC hDC          = ( HDC ) _parnl( 2 );
   WORD wRows;
   WORD wLastBottom = 0;
   WORD wRow        = 1;
   WORD wSkipped    = 1;
   void * Self    = _param( 3, -1 );
   void * bLine   = _param( 4, -1 );
   void * pASizes = _param( 5, -1 );
   HFONT hFont      = ( HFONT ) _parnl( 9 );
   HFONT hOldFont;
   BOOL bDestroyDC  = FALSE;
   WORD wHeight ;
   RECT rct, box, client;
   WORD wIndex      = _parni( 6 );
   void * bClrFore = 0;
   void * bClrBack = 0;
   COLORREF clrFore = 0;
   COLORREF clrBack = 0;
   HPEN hGrayPen    = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) ) ; // RGB( 128, 128, 128 ) );
   HPEN hWhitePen   = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) ); // GetStockObject( WHITE_PEN );

   BOOL bColBlock   = ( _itemType( pASizes ) & BLOCK );

   void * pAJustify = ISARRAY( 10 ) ? _param( 10, -1 ): 0;
   WORD nHeightCtrl ; // by CeSoTech
   WORD nStyle = _parni( 11 );

   if( PCOUNT() > 6 )
   {
      if( ISBLOCK( 7 ) )
         bClrFore = _param( 7, -1 );
      else
         clrFore = _parnl( 7 );
   }

   if( PCOUNT() > 7 )
   {
      if( ISBLOCK( 8 ) )
      {
         bClrBack = _param( 8, -1 );
         _cEval0( bClrBack );
         clrBack = _parnl( -1 );
      }
      else
         clrBack = _parnl( 8 );
   }

   if( ! hDC )
   {
      bDestroyDC = TRUE;
      hDC = GetDC( hWnd );
   }

   if( ! pSkip )
       pSkip = _get_sym( "SKIP" );

   if( hFont )
      hOldFont = SelectObject( hDC, hFont );

   /////////////////////////
   // Borremos el Area de la derecha no coubierta
   if ( !bAdjBrowse && !bAdjLastCol )
   {
       GetClientRect( hWnd, &rct );
       SetBkColor( hDC, _parnl( 17 ) ) ;

       for( wIndex=wIndex ; wIndex <= (WORD) _parinfa( 5, NULL); wIndex++ )
       {
            rct.left += _parni( 5, wIndex ) ;
       }

       if ( !(nStyle == 0 || nStyle == 7 || nStyle == 8 || nStyle == 3) )
          rct.left++;

       ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED,
                   &rct, "", 0, 0 );

       wIndex = _parni( 6 );
       GetClientRect( hWnd, &rct );
   }
   /////////////////////////

   GetClientRect( hWnd, &client );

   nHeightCtrl = client.bottom-client.top ; // by CeSoTech

   wHeight = wLineHeight + 1 ;

   wRows = WBrwRowsC( hWnd, hDC, hFont );

   if( ! bClrFore )
      SetTextColor( hDC, clrFore );
      SetBkColor( hDC, clrBack );

   while( wRow <= wRows && wSkipped == 1 )
   {
      rct.top    = client.top + ( bDrawHeaders ? wHeaderHeight+1 : 0 ) +
                   (wHeight * (wRow-1) ) ;

      rct.bottom = rct.top + wHeight;
      rct.left   = 0;
      rct.right  = client.right;

      _cEval0( bLine );
      _xpushm( _eval );

      if( bClrFore )
      {
         _cEval0( bClrFore );
         SetTextColor( hDC, _parnl( -1 ) );
      }

      if( bClrBack )
      {
         _cEval0( bClrBack );
         SetBkColor( hDC, _parnl( -1 ) );
      }

      if( bColBlock )
         _cEval0( pASizes );

      PaintTheLine( hDC, &rct, wIndex, _tos,
                    ( bColBlock ? _eval : pASizes ),
                    hWhitePen, hGrayPen,
                    bColBlock, pAJustify, 0, FALSE, _parni( 11 ),
                    _parni ( 12 ), _parl( 13 ),
                    ISBLOCK( 14 ) ? _param( 14, -1 ) : 0,   // CeSoTech
                    ISBLOCK( 15 ) ? _param( 15, -1 ) : 0,   // CeSoTech
                    wRow, nHeightCtrl,                      // CeSoTech
                    ISNUM( 16 ) ? _parnl( 16 ) : -1,        // CeSoTech
                    FALSE, FALSE,                           // CeSoTech
                    ISBLOCK( 18 ) ? _param( 18, -1 ) : 0,   // CeSoTech
                    FALSE ) ;

      _0POP();

      _putsym( pSkip );
      _xpushm( Self );
      _putq( 1 );
      _xsend( 1 );

      wLastBottom = rct.bottom ;
      wSkipped = _parni( -1 );

      if( wSkipped == 1 )
          wRow++;
   }

   ////////////////////////
   // Borremos el Area de Abajo no cubierta
   GetClientRect( hWnd, &rct );
   SetBkColor( hDC, _parnl( 17 ) ) ;

   rct.top = wLastBottom + 1 ;
   if ( wLastBottom == 0 ) // No Mostro Registros
      rct.top = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) ;

   rct.bottom-=  1 + ( bDrawFooters ? wFooterHeight+1 : 0 ) ;

   if (nStyle == 0 || nStyle == 5 || nStyle == 6 ||
       nStyle == 9 || nStyle == 10 || nStyle == 3 )
      rct.top--;

   if ( !bDrawFooters )
      rct.bottom++;


   if ( rct.top < rct.bottom )
   {
      ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED,
                  &rct, "", 0, 0 );
   }
   ////////////////////////

   DeleteObject( hGrayPen );
   DeleteObject( hWhitePen );

   if( hFont )
      SelectObject( hDC, hOldFont );

   if( bDestroyDC )
       ReleaseDC( hWnd, hDC );

   _retni( wRow );

}
Exemple #29
0
//---------------------------------------------------------------------------//
CLIPPER WBRWRECT( void ) // ( hWnd, nRow, aSizes, nFirstItem, nCol,
                           //   nLineStyle, nWidthVScroll )
{
   HWND hWnd        = ( HWND ) _parnl( 1 );

   HDC hDC          = GetDC( hWnd );
   WORD wRow        = _parni( 2 );
   WORD wHeight ;
   RECT rct;
   WORD nStyle = ISNUM( 6 ) ? _parni( 6 ) : -1 ; // CeSoTech


   void * paSizes   = _param( 3, S_ARRAY );
   WORD wLen        = _VARRAYLEN( paSizes );
   WORD wIndex      = _parni( 4 );
   WORD wCol        = _parni( 5 );
   WORD wMaxRight;
   LONG l;

   if( !wCol || wCol > wLen )
        return;


   GetWindowRect( hWnd, &rct );
   wMaxRight = rct.right - 2;

   wHeight = wLineHeight + 1 ;

   rct.top    = rct.top + ( bDrawHeaders ? wHeaderHeight+1 : 0 ) +
                (wHeight * (wRow-1) ) ;


   rct.bottom = rct.top + wHeight;
   rct.right  = rct.left;

   while( wIndex <= wCol )
   {
        rct.left   = rct.right;
        rct.right  = ( wIndex == wLen && bAdjLastCol ? wMaxRight
                                         : rct.left + GetInt( paSizes, wIndex ) );

        if( rct.right >= wMaxRight )
        {
            wIndex = wCol + 1;   // ya no pintamos m s
            rct.right = wMaxRight;
        }
        else
            wIndex++;
   }



   ReleaseDC( hWnd, hDC );

   _reta( 4 );

   // Si es un estilo sin separadores horizontales, pintar uno mas arriba
   //CeSoTech para que que bien completa el area !!!
   if (nStyle == 0 || nStyle == 5 || nStyle == 6 || nStyle == 9 || nStyle == 10)
      rct.top-- ;  // Las coord.de edicion deberan ser mas arriba tambien !!!


   _storni( rct.top,    -1, 1 );
   _storni( rct.left,   -1, 2 );
   _storni( rct.bottom, -1, 3 );
   _storni( ( wMaxRight <= rct.right ) ?
              wMaxRight - _parni( 7 ) : rct.right, -1, 4 );
}
Exemple #30
0
//---------------------------------------------------------------------------//
CLIPPER WBRWLINE( void ) // ( hWnd, hDC, nRow, aText, aSizes, nFirstItem, ;
                           // nClrFore, nClrBack, hFont, lTree, aJustify, nPressed,
                           // nStyle, nColAct, lFocused )
                           // bTextColor, bBkColor, nClrLine, lFooter, lSelect,
                           // bFont, lDrawFocusRect ) // New's by CesoTech

{
   HWND hWnd        = (HWND) _parnl( 1 );
   HDC hDC          = (HDC) _parnl( 2 );
   WORD wRow        = _parni( 3 );
   BOOL bDestroyDC  = FALSE;
   WORD wHeight;
   RECT rct, box;
   void * bClrFore;
   void * bClrBack;
   COLORREF clrFore = 0;
   COLORREF clrBack = 0;
   HPEN hGrayPen    ;
   HPEN hWhitePen   ;
   HFONT hFont      = (HFONT) _parnl( 9 );
   HFONT hOldFont;
   BOOL bTree       = _parl( 10 );
   BOOL bFooter     = ISLOGICAL( 19 ) ? _parl( 19 ) : FALSE ;  // CeSoTech

   WORD nHeightCtrl ; // by CeSoTech

   hGrayPen    = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) ) ; // RGB( 128, 128, 128 ) );
   hWhitePen   = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) ); // GetStockObject( WHITE_PEN );

   if( PCOUNT() > 6 )
   {
      if( ISBLOCK( 7 ) )
      {
         bClrFore = _param( 7, -1 );
         _cEval0( bClrFore );
         clrFore = _parnl( -1 );
      }
      else
      {
         clrFore = _parnl( 7 );
      }
   }

   if( PCOUNT() > 7 )
   {
      if( ISBLOCK( 8 ) )
      {
         bClrBack = _param( 8, -1 );
         _cEval0( bClrBack );
         clrBack = _parnl( -1 );
      }
      else
      {
         clrBack = _parnl( 8 );
      }
   }

   if( ! hDC )
   {
      bDestroyDC = TRUE;
      hDC = GetDC( hWnd );
   }

   if( hFont )
      hOldFont = SelectObject( hDC, hFont );

   GetClientRect( hWnd, &rct );

   nHeightCtrl = rct.bottom-rct.top ; // by CeSoTech

   SetTextColor( hDC, clrFore );
   SetBkColor( hDC, clrBack );

   wHeight = wLineHeight + 1 ;

   if ( ( wRow == 0 ) && bDrawHeaders )  // Es una Cabecera
      wHeight = wHeaderHeight + 1 ;

   if ( ! bFooter )
   {
      if ( ( wRow == 0 ) && bDrawHeaders )  // Es una Cabecera
      {
         rct.top    = 0 ;
         rct.bottom = wHeaderHeight + 1 ;
      }
      else
      {
        rct.top    = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) + (wHeight * (wRow-1) )  ;
        rct.bottom = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) + (wHeight * wRow)  ;
      }

   } else {
      rct.top    = rct.bottom - (wFooterHeight+1) ;
   }

   rct.left   = 0;

   PaintTheLine( hDC, &rct, _parni( 6 ), _param( 4, -1 ), _param( 5, -1 ),
                 hWhitePen, hGrayPen, bTree,
                 ISARRAY(11) ? _param( 11, -1 ) : 0, _parni( 12 ),
                 (wRow == 0), _parni( 13 ),
                 _parni( 14 ), _parl( 15 ),
                 ISBLOCK( 16 ) ? _param( 16, -1 ) : 0,   // CeSoTech
                 ISBLOCK( 17 ) ? _param( 17, -1 ) : 0,   // CeSoTech
                 wRow, nHeightCtrl,                      // CeSoTech
                 ISNUM( 18 ) ? _parnl( 18 ) : -1,        // CeSoTech
                 bFooter,                                // CeSoTech
                 ISLOGICAL( 20 ) ? _parl( 20 ) : FALSE,  // CeSoTech
                 ISBLOCK( 21 ) ? _param( 21, -1 ) : 0,   // CeSoTech
                 ISLOGICAL( 22 ) ? _parl( 22 ) : FALSE );// CeSoTech

   DeleteObject( hGrayPen );
   DeleteObject( hWhitePen );

   if( hFont )
      SelectObject( hDC, hOldFont );

   if( bDestroyDC )
       ReleaseDC( hWnd, hDC );

   _reta( 2 );
   _storni( rct.top,    -1, 1 );
   _storni( rct.bottom, -1, 2 );

}