CLIPPER chgattr() { if (! (PCOUNT==3 || ISCHAR(1) || ISNUM(2) || ISNUM(3))) _retni(0); else _retni(_chmod(_parc(1),_parni(3),_parni(2))); }
CLIPPER c_fwrite (void) { int file_handle; char *line; USHORT line_size; if (PCOUNT == 3 && ISNUM(FILE_HANDLE) && ISCHAR(WRITE_LINE) && ISNUM(LINE_SIZE) && ISBYREF(LINE_SIZE)) { /* convert clipper parameters into C types... */ file_handle = _parni(FILE_HANDLE); line_size = _parni(LINE_SIZE); line = _parc(WRITE_LINE); /* call C write function... */ if ( _fsWrite(file_handle, line, line_size) < line_size ) { _storni (0, LINE_SIZE); _ret(); return; } /* flush the data to file without closing it... */ if (asm_commit(file_handle)) _storni (0, LINE_SIZE); } else /* update line_size to zero... */ _storni (0, LINE_SIZE); _ret(); /* returns NIL */ }
CLIPPER memin() { if (! (PCOUNT==2 || ISNUM(1) || ISNUM(2))) _retni(0); else _retni((char)peekb(_parni(1),_parni(2))); }
CLIPPER SetMArea() { MouseSetArea( _parni( 1 ), _parni( 2 ), _parni( 3 ), _parni( 4 ) ); }
CLIPPER SETSOCKOPT( PARAMS ) // SOCKET s, int level, int optname, const char FAR * optval, int optlen #endif { BOOL bTrue = 1; _retl( setsockopt( _parni( 1 ), _parni( 2 ), _parni( 3 ), ( char * ) &bTrue, 2 ) == 0 ); }
CLIPPER memout() { if (! (PCOUNT==3 || ISNUM(1) || ISNUM(2) || ISNUM(3))) _retl(0); else { pokeb(_parni(1),_parni(2),(char)_parni(3)); _retl(1); } }
CLIPPER portout() { if (! (PCOUNT==2 || ISNUM(1) || ISNUM(2))) _retl(0); else { outportb(_parni(1),(char)_parni(2)); _retl(1); } }
CLIPPER WBRWSELBOX( PARAMS ) // ( hWnd, hDC, nRow, nFirstCol, nCurCol,; // lFocus, aSizes, hFont) #endif { HWND hWnd = (HWND) _parnl( 1 ); HDC hDC = (HDC) _parnl( 2 ); WORD wRow = _parni( 3 ); WORD wIndex = _parni( 4 ); WORD wCol = _parni( 5 ); BOOL bFocused = _parl( 6 ); PCLIPVAR pAsizes = _param( 7, -1 ); HFONT hFont = (HFONT) _parnl( 8 ); BOOL bDestroyDC = FALSE; TEXTMETRIC tm; RECT rct; HFONT hOldFont; if( ! hDC ) { bDestroyDC = TRUE; hDC = GetDC( hWnd ); } if( hFont ) hOldFont = SelectObject( hDC, hFont ); GetClientRect( hWnd, &rct ); GetTextMetrics( hDC, &tm ); if( hFont ) SelectObject( hDC, hOldFont ); tm.tmHeight += 1; if ( ! bDrawHeaders ) // By CeSoTech wRow-- ; rct.top = tm.tmHeight * wRow ; rct.bottom = tm.tmHeight * ( wRow + 1) - 1; rct.left = 0; while( wIndex < wCol ) rct.left += GetInt( pAsizes, wIndex++ ); rct.right = rct.left+GetInt( pAsizes, wCol ) - 1; MaskRegion( hDC, &rct, GetBkColor( hDC ), GetSysColor(COLOR_ACTIVECAPTION) ); if( bFocused ) DrawFocusRect( hDC, &rct ); if( bDestroyDC ) ReleaseDC( hWnd, hDC ); }
CLIPPER SetMGPos( void ) // ( nGrafRow, nGrafCol { WORD wGrafRow, wGrafCol; wGrafRow = _parni( 1 ); wGrafCol = _parni( 2 ); _DX = wGrafRow; _CX = wGrafCol; _AX = 4; asm int 0x33; }
//---------------------------------------------------------------------------// CLIPPER WBRWSET() // ( lAdjLastCol, lAdjBrowse, lDrawHeaders, lDrawFooters ) { // CeSoTech bAdjLastCol = _parl( 1 ) ; // Ajuste o no de ultima columna al control. bAdjBrowse = _parl( 2 ) ; // Ajuste del Browse a la derecha // cuando no existe ajuste de ultima columna. bDrawHeaders = _parl( 3 ) ; // Si quiere visualizar Headers !!! bDrawFooters = _parl( 4 ) ; // Si se quiere visualizar Footers !!! wHeaderHeight= _parni( 5 ) ; wFooterHeight= _parni( 6 ) ; wLineHeight = _parni( 7 ) ; }
CLIPPER CONNECTTO( PARAMS ) // nSocket, nPort, cIPAddr --> lSuccess #endif { SOCKADDR_IN sa; // sockaddr_in sa; _bset( ( char * ) &sa, 0, sizeof( sa ) ); sa.sin_family = AF_INET; sa.sin_port = htons( _parni( 2 ) ); sa.sin_addr.s_addr = inet_addr( _parc( 3 ) ); _retnl( connect( _parni( 1 ), ( SOCKADDR * ) &sa, sizeof( sa ) ) ); }
CLIPPER randomic() { if (! (PCOUNT==1 || ISNUM(1))) _retni(0); else _retni(random(_parni(1))); }
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 portin() { if (! (PCOUNT==1 || ISNUM(1))) _retni(0); else _retni((int)inportb(_parni(1))); }
CLIPPER setdrive() { if (! (PCOUNT==1 || ISNUM(1))) _retni(0); else _retni(setdisk(_parni(1))); }
/***************************************************************************** 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 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); }
CLIPPER SOCKETSEND( PARAMS ) // nSocket, cText --> nResult #endif { WORD wLen = _parclen( 2 ); if( wLen > 32350 ) wLen = 32350; _retni( _send( _parni( 1 ), _parc( 2 ), wLen, 0 ) ); }
CLIPPER GETPEERNAM( PARAMS ) // E( nSocket ) #endif { SOCKADDR_IN sa; // sockaddr_in sa; int iLen = sizeof( sa ); _bset( ( char * ) &sa, 0, sizeof( sa ) ); getpeername( _parni( 1 ), ( SOCKADDR * ) &sa, &iLen ); _retc( inet_ntoa( sa.sin_addr ) ); }
CLIPPER WBrwScrl( PARAMS ) // ( hWnd, nRows, hFont, nLineStyle, hDC ) #endif { HWND hWnd = ( HWND ) _parnl( 1 ); int wRows = _parni( 2 ); HFONT hFont = ( HFONT ) _parnl( 3 ); HFONT hOldFont; HDC hDC = ( HDC ) _parnl( 5 ); // = GetDC( hWnd ); RECT rct; WORD nStyle = _parni( 4 ); if( hFont ) hOldFont = SelectObject( hDC, hFont ); GetClientRect( hWnd, &rct ); if ( bDrawHeaders ) rct.top += wHeaderHeight+1 ; // Defino Bottom de Area del Scroll rct.bottom = ( WBrwRowsC( hWnd, hDC, hFont ) * (wLineHeight+1) ) + ( bDrawHeaders ? wHeaderHeight+1 : 0 ) ; // Si es un estilo sin separadores horizontales, pintar uno mas arriba // CeSoTech para que que bien completa el area !!! // El Area Scroll deber entonces no tomar el separator (forma parte de ant) if ( !(nStyle == 0 || nStyle == 5 || nStyle == 6 || nStyle == 9 || nStyle == 10 || nStyle == 3 ) ) rct.bottom++; // Debe tomarse dado que no pinta celda 1 una mas arriba // ScrollWindowEx( hWnd, 0, -( (wLineHeight+1) * wRows ), 0, &rct, 0, 0, 0 ); ScrollDC( hDC, 0, -( (wLineHeight+1) * wRows ), 0, &rct, 0, 0 ); if( hFont ) SelectObject( hDC, hOldFont ); // ReleaseDC( hWnd, hDC ); }
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 ) ); }
CLIPPER BINDTOPORT( PARAMS ) // nSocket, nPort, nAddr1, nAddr2, nAddr3, nAddr4 --> lSuccess #endif { SOCKADDR_IN sa; // sockaddr_in sa; _bset( ( char * ) &sa, 0, sizeof( sa ) ); sa.sin_family = AF_INET; sa.sin_port = htons( _parni( 2 ) ); /* sa.sin_addr.s_net = _parni( 3 ); sa.sin_addr.s_host = _parni( 4 ); sa.sin_addr.s_lh = _parni( 5 ); sa.sin_addr.s_impno = _parni( 6 ); */ sa.sin_addr.s_addr = htonl( INADDR_ANY ); _retl( bind( _parni( 1 ), ( SOCKADDR * ) &sa, sizeof( sa ) ) == 0 ); }
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 ) ); }
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.
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 ); }
CLIPPER AWBRWROWDIM( PARAMS ) { HWND hWnd = _parni( 1 ); WORD wRow = _parni( 2 ); HFONT hFont = _parni( 3 ); HFONT hOldFont; HDC hDC = GetDC( hWnd ); TEXTMETRIC tm; if( hFont ) hOldFont = SelectObject( hDC, hFont ); GetTextMetrics( hDC, &tm ); tm.tmHeight += 1; if( hFont ) SelectObject( hDC, hOldFont ); ReleaseDC( hWnd, hDC ); _reta( 2 ); _storni( tm.tmHeight * wRow++, -1, 1 ); _storni( tm.tmHeight * wRow, -1, 2 ); }
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 ) ); }
CLIPPER MGETCREATE( PARAMS ) // ( cClassName, cTitle, nStyle, nLeft, nTop, // nWidth, nHeight, hWndOwner, hMenu, // cExtraData, nExStyle ) --> hWnd { DWORD dwStyle = ( DWORD ) _parnl( 3 ); DWORD dwExStyle = ( DWORD ) _parnl( 11 ); #ifndef __FLAT__ if( ! ghEditDS ) { if( ghEditDS = GlobalAlloc( GMEM_DDESHARE | GMEM_MOVEABLE | GMEM_ZEROINIT, SEGMENT ) ) { lpPtr = GlobalLock( ghEditDS ); LocalInit( HIWORD( (LONG) lpPtr ), 0, ( WORD )( GlobalSize( ghEditDS ) - 16 ) ); UnlockSegment( HIWORD( ( LONG ) lpPtr ) ); } } _stornl( ( LONG ) ( IF( ghEditDS, ghEditDS, 0 ) ), 10 ); // lpPtr #endif _retnl( ( LONG ) CreateWindowEx( dwExStyle, _parc( 1 ), // Class _parc( 2 ), // Title dwStyle, // Style _parni( 4 ), // Left _parni( 5 ), // Top _parni( 6 ), // Width _parni( 7 ), // Height ( HWND ) _parnl( 8 ), // Parent ( HMENU ) _parnl( 9 ), // Menu ( HINSTANCE ) IF( ghEditDS, HIWORD( ( LONG ) lpPtr ), __hInstance ), ( LPVOID ) ( ( PCOUNT() > 9) ? _parc( 10 ): 0 ) ) ); // Address Window-Creation-Data }
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; } }
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; } }