Exemple #1
0
    CLIPPER RECV( PARAMS )  //  nSocket --> cResult
#endif
{
   LPBYTE buffer = ( LPBYTE ) _xgrab( 8192 );
   WORD wLen = recv( _parni( 1 ), ( char * ) buffer, 8192, 0 );

   if( wLen < 10000 )  // socket errors = 10000 + ...
      _storclen( ( char * ) buffer, wLen, 2 );
   else
      _storclen( "", 0, 2 );

   _retni( wLen );
   _xfree( buffer );
}
Exemple #2
0
CLIPPER veri_recv()
{
  unsigned char buffer[100];
  int data=0,i;
  long far *timer_ticks = (long far *) 0x0040006CL;
  long timein = *timer_ticks+1080L;
  char far * str_txt;

  
  if ( PCOUNT == 2 && ISBYREF(BYTES_READ) && ISNUM(BYTES_READ)
                    && ISBYREF(STR_TXT)  && ISCHAR(STR_TXT) )
  {
     str_txt = _parc(STR_TXT);
     
     i = 0;
     while ( ((data & 0x00ff) != 0x03)  &&  ( timein > *timer_ticks ))
     {
       if (pfl_com_sts(port_no) & DATA_READY)
       {
	 data = pfl_com_drecv();
	 buffer[i++] = (unsigned char) (data & 0x00ff);            
       }    
     }  
     
     _storni(i,BYTES_READ);
     _storclen(buffer,i,STR_TXT);
     _retni(NORMAL);
  }
  else
     _retni(INVP);
      
}
Exemple #3
0
CLIPPER HB_STRINGS8()
{
   _storclen( _parc( 2 ), _parnl( 3 ), 1, 1 );
}
Exemple #4
0
CLIPPER HB_UNDOC12()
{
   _retc( _parc( 1 ) );
   _storclen( "CLIPPER power!!!", _parni( 2 ), -1 );
}
Exemple #5
0
CLIPPER read_scan(void)
{
  int barcode_sts;  /* scanner input status */
  int barcode_len;  /* holds the no. of bytes actually read */
  int check_flag = 0;  
  int label_chkdigit,chkdigit;
    
  if ((PCOUNT >= 2) && ISBYREF(BYTES_READ) && ISNUM(BYTES_READ) &&
                     ISBYREF(STR_BUFF) && ISCHAR(STR_BUFF))
  {
     /* verify initial status */
     if (chk_init_flag(POS_SCAN) == 0)
     {
        _retni(DEV_NOT_EXIST);   
        return;
     } /* device not yet initialized */

    /* not in asynchronous scanning mode */
    if (!async_scan)
    {
      _retni(INVP);
      return;
    }
    
    /* read scanner input */
    if ((barcode_sts = pfl_get_label(label_buff)) == -1)
      barcode_sts = READ_ERR;  /* no available data to be fetched */
    else
    {
      barcode_len = barcode_sts & 0x00ff;              /* get label length */
      barcode_sts >>= 8;                               /* label status     */

      barcode_sts = (barcode_sts == 0)? NORMAL: SCAN_ERR;  /* status      */
      
      if ( PCOUNT == 3 )
      {
        int check_flag = _parl(CHECK_FLAG);      
        if (check_flag)
        {  
           barcode_len--;                
                    
           label_chkdigit = (int) label_buff[barcode_len] - 48 ;
           
           chkdigit = checkdgt(label_buff,barcode_len);           

           if ( label_chkdigit !=  chkdigit )
             barcode_sts = SCAN_ERR;
                                       
        }   
        
      }     

      _storni(barcode_len, BYTES_READ);                /* length */
        
      *(label_buff+barcode_len+1) = '\0';              /* insert a NULL character */
      _storclen(label_buff, barcode_len+2, STR_BUFF);  /* bar code data */        
                          
    }
    
    _retni(barcode_sts);
  }
  else