CLIPPER memin()
{
    if (! (PCOUNT==2 || ISNUM(1) || ISNUM(2)))
        _retni(0);
    else
        _retni((char)peekb(_parni(1),_parni(2)));
}
CLIPPER randomic()
{
    if (! (PCOUNT==1 || ISNUM(1)))
        _retni(0);
    else
        _retni(random(_parni(1)));
}
CLIPPER chgattr()
{
    if (! (PCOUNT==3 || ISCHAR(1) || ISNUM(2) || ISNUM(3)))
        _retni(0);
    else
        _retni(_chmod(_parc(1),_parni(3),_parni(2)));
}
CLIPPER portin()
{
    if (! (PCOUNT==1 || ISNUM(1)))
        _retni(0);
    else
        _retni((int)inportb(_parni(1)));
}
예제 #5
0
파일: Force.c 프로젝트: azulae/Gestool
CLIPPER DbfHdl( void )
{
   if( _nversion( 1 )[ 14 ] == '3' )
      _retni( * ( (int *) ( ( (char *) (*_WorkAreas) ) + 0x82 ) ) ) ;
   else
      _retni( * ( (int *) ( ( (char *) (*_WorkAreas) ) + 0x70 ) ) ) ;
}
CLIPPER setdrive()
{
    if (! (PCOUNT==1 || ISNUM(1)))
        _retni(0);
    else
        _retni(setdisk(_parni(1)));
}
예제 #7
0
파일: VERIFONE.C 프로젝트: ibarrar/clipper
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);
      
}
예제 #8
0
파일: POS_INIT.C 프로젝트: ibarrar/clipper
/*****************************************************************************
  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);
}
예제 #9
0
CLIPPER nStrColor( void ) // ( szColor, nClrIndex )
{
    PCLIPVAR pClr    = _param( 1, CHARACTER );
    BOOL bNeedUnLock;
    char * szColor;
    WORD wStart      = 0;
    WORD wEnd        = 0;
    BYTE bEnd;
    WORD wAtt;

    if( ! pClr || _parclen( 1 ) == 0 )
    {
        _retni( 0 ); // Default Color.
        return;
    }

    bNeedUnLock = _VSTRLOCK( pClr );
    szColor   = _VSTR( pClr );

    wEnd = wStart = wScanSep( szColor, _parni( 2 ) );

    while( szColor[ wEnd ] && szColor[ wEnd ] != ',' )
        wEnd++;

    bEnd = szColor[ wEnd ];
    szColor[ wEnd ] = 0;

    _retni( ucColor2N( szColor + wStart ) );

    szColor[ wEnd ] = bEnd;

    if( bNeedUnLock )
       _VSTRUNLOCK( pClr );

}
CLIPPER dosversion()
{
    union REGS utl_reg;
    utl_reg.h.ah = 0x30;
    int86(0x21,&utl_reg,&utl_reg);
    _retni(utl_reg.x.ax);
}
예제 #11
0
파일: FILEOPEN.C 프로젝트: ibarrar/clipper
CLIPPER FILEOPEN()
{
   BYTEP fpFileName;
   FHANDLE hFile = FS_ERROR;
   USHORT uiFlags = FO_READWRITE;
   ERRORP pError;

   if ( ISCHAR( 1 ) )
   {
      fpFileName = _parc( 1 );

      uiFlags |= ( ISLOG( 2 ) && _parl( 2 ) ) ? FO_SHARED : FO_EXCLUSIVE;

      pError = _errNew();
      _errPutSubCode( pError, 1111 );     // subCode determined by caller

      hFile = FileOpener( fpFileName, uiFlags, pError );

      if ( ISBYREF( 1 ) )
         _storc( fpFileName, 1 );
   }

   _retni( hFile );

}
예제 #12
0
파일: Winsock.c 프로젝트: azulae/Gestool
    CLIPPER WSASTARTUP( PARAMS )
#endif
{
   WSADATA wsa;

   _retni( WSAStartup( 0x101, &wsa ) );
}
예제 #13
0
파일: GSCRREST.C 프로젝트: ibarrar/clipper
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);

}
예제 #14
0
파일: Attribc3.c 프로젝트: azulae/Gestool
CLIPPER SETATTRIBUTES( void )
{
    DWORD dwFlags=FILE_ATTRIBUTE_ARCHIVE;
    DWORD dwLastError=ERROR_SUCCESS;
    BOOL lSuccess;
    LPCTSTR cFile=_parc( 1 );
    int iAttr=_parni( 2 );

    if( iAttr & FC_READONLY )
       dwFlags |= FILE_ATTRIBUTE_READONLY;

    if( iAttr & FC_HIDDEN )
       dwFlags |= FILE_ATTRIBUTE_HIDDEN;

    if( iAttr & FC_SYSTEM )
       dwFlags |= FILE_ATTRIBUTE_SYSTEM;

    if( iAttr & FC_NORMAL )
       dwFlags |= FILE_ATTRIBUTE_NORMAL;

    lSuccess=SetFileAttributes( cFile, dwFlags );

    if ( lSuccess )
    {
       _retni( dwLastError );
    }
    else
    {
       dwLastError=GetLastError();

       switch ( dwLastError )
       {
          case ERROR_FILE_NOT_FOUND :
             _retni( -2 );
             break;
          case ERROR_PATH_NOT_FOUND :
             _retni( -3 );
             break;
          case ERROR_ACCESS_DENIED:
             _retni( -5 );
             break;
          default:
             _retni( -1 );
       }
    }
}
예제 #15
0
파일: CHK_JRNL.C 프로젝트: ibarrar/clipper
CLIPPER chk_jrnal(void)
{
  int gen_status; /* generic error codes returned to the application */
  unsigned char esc_cmd[5];  
  int paper_sts;

  /* validate parameters */
  if (PCOUNT == 0)  /* no argument is passed */
  {
    /* verify initial status */
    if (chk_init_flag(POS_PRINTER) == 0)
    {
      _retni(DEV_NOT_EXIST);   /* device not yet initialized */
      return;
    }

    /* allow current print jobs to finish */
    while (!print_stop && !buffer_empty)
      delay(10); 

/*    delay(100);   put some delay to allow any current print jobs to finish */              
    
    gen_status = NORMAL;  /* assume normal */
    
    /* query cash journal paper status */

    esc_cmd[0] = ESC_CODE;
    esc_cmd[1] = 'c';
    esc_cmd[2] = '3';
    esc_cmd[3] = 1;    

    pfl_lpt_nsend(pos_setup[POS_PRINTER].lpt_port, esc_cmd, 4);    

    delay(50);  /* put some delay */

    paper_sts = pfl_lpt_sts(pos_setup[POS_PRINTER].lpt_port);    

    if (paper_sts & 0x0020)  /* out of paper? */
      gen_status = PAPER_ERR;
    
    _retni(gen_status); 
  }
  else
    _retni(INVP);
}
예제 #16
0
파일: POS_INIT.C 프로젝트: ibarrar/clipper
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);
}
예제 #17
0
파일: Winsock.c 프로젝트: azulae/Gestool
    CLIPPER SENDBINARY( PARAMS )  //  nSocket, pMemory --> nResult
#endif
{
   WORD wLen = _parnl( 3 );

   if( wLen > 32350 )
       wLen = 32350;

   _retni( _send( _parni( 1 ), ( LPSTR ) _parnl( 2 ), wLen, 0 ) );
}
예제 #18
0
파일: Winsock.c 프로젝트: azulae/Gestool
    CLIPPER SOCKETSEND( PARAMS )  //  nSocket, cText --> nResult
#endif
{
   WORD wLen = _parclen( 2 );

   if( wLen > 32350 )
       wLen = 32350;

   _retni( _send( _parni( 1 ), _parc( 2 ), wLen, 0 ) );
}
예제 #19
0
파일: SOUND_OF.C 프로젝트: ibarrar/clipper
CLIPPER sound_off(void)
{
  /* validate parameters */
  if (PCOUNT == 0)  /* no argument is passed */  
  {
    if (!in_sound)  
    {
      _retni(INVP);
      return;
    }
    
    unhook_keytone();

    in_sound = 0; 
    
    _retni(NORMAL);
  }
  else
    _retni(INVP);
}
예제 #20
0
파일: Winsock.c 프로젝트: azulae/Gestool
    CLIPPER GETPORT( PARAMS ) // nSocket
#endif
{
   SOCKADDR_IN sa; // sockaddr_in sa;
   int iLen = sizeof( sa );

   _bset( ( char * ) &sa, 0, sizeof( sa ) );
   getsockname( _parni( 1 ), ( SOCKADDR * ) &sa, &iLen );

   _retni( ntohs( sa.sin_port ) );
}
예제 #21
0
파일: VERIFONE.C 프로젝트: ibarrar/clipper
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);
}  
예제 #22
0
파일: Winsock.c 프로젝트: azulae/Gestool
   CLIPPER SOCKETSELE( PARAMS ) // CT( nSocket )
#endif
{
   struct timeval timeout;
   fd_set setWrite;

   FD_ZERO( &setWrite );
   FD_SET( ( /*WORD*/ unsigned int ) _parni( 1 ), &setWrite );
   timeout.tv_sec  = 0;
   timeout.tv_usec = 0;

   // _retl( select( 0, 0, &setWrite, 0, &timeout ) == 0 );
   _retni( select( 0, 0, &setWrite, 0, 0 ) );  // 0 instead &timeout makes wait
}                                                  // for ever.
예제 #23
0
파일: Winsock.c 프로젝트: azulae/Gestool
    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 );
}
예제 #24
0
파일: Winsock.c 프로젝트: azulae/Gestool
    CLIPPER ACCEPT( PARAMS )  //  nSocket --> nResult
#endif
{
   SOCKADDR_IN sa; // sockaddr_in sa;
   int iLen = sizeof( sa );

   sa.sin_family       = AF_INET;
   sa.sin_port         = 0;
   sa.sin_addr.s_net   = 0;
   sa.sin_addr.s_host  = 0;
   sa.sin_addr.s_lh    = 0;
   sa.sin_addr.s_impno = 0;

   _retni( accept( _parni( 1 ), ( SOCKADDR * ) &sa, &iLen ) );
}
예제 #25
0
파일: VERIFONE.C 프로젝트: ibarrar/clipper
CLIPPER veri_send()
{
 char far * text;
 int status = INVP;
 int textlen;
 
  if (PCOUNT == 1 && ISCHAR(TXT))
  {      
      text = _parc(TXT);
      textlen = _parclen(TXT);
      status = pfl_com_nsend( text, textlen );
  }
  
  _retni(status);         
    
}
예제 #26
0
파일: Wbrwc3.c 프로젝트: azulae/Gestool
//----------------------------------------------------------------------------//
CLIPPER WBRWHEIGHT( void ) // ( hWnd, hFont )
{
   HWND hWnd   = ( HWND ) _parnl( 1 );
   HFONT hFont = ( HFONT ) _parnl( 2 );
   HFONT hOldFont;
   HDC hDC     = GetDC( hWnd );
   TEXTMETRIC tm;

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

   GetTextMetrics( hDC, &tm );
   _retni( tm.tmHeight ) ;

   if( hFont )
      SelectObject( hDC, hOldFont );

   ReleaseDC( hWnd, hDC );
}
예제 #27
0
파일: MOUSE.C 프로젝트: fabioandrec/fivedos
CLIPPER MRow()
{
    _gtmGetPos( 0 );
    _retni( bMouseRow() );
}
예제 #28
0
파일: MOUSE.C 프로젝트: fabioandrec/fivedos
CLIPPER nMCol()      { _retni( bMouseCol() ); }
예제 #29
0
파일: MOUSE.C 프로젝트: fabioandrec/fivedos
CLIPPER nMRow()      { _retni( bMouseRow() ); }
예제 #30
0
파일: MOUSE.C 프로젝트: fabioandrec/fivedos
CLIPPER MCol()
{
    _gtmGetPos( 0 );
    _retni( bMouseCol() );
}