CLIPPER GETSERVBYN( PARAMS ) // AME( cServerName ) --> nPort #endif { struct servent * pServer; pServer = getservbyname( _parc( 1 ), _parc( 2 ) ); _retnl( IF( pServer, pServer->s_port, 0 ) ); }
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 chgattr() { if (! (PCOUNT==3 || ISCHAR(1) || ISNUM(2) || ISNUM(3))) _retni(0); else _retni(_chmod(_parc(1),_parni(3),_parni(2))); }
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 ); }
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); }
CLIPPER mkdirct() { char *utl_pth = _parc(1); if (! (PCOUNT==1 || ISCHAR(1))) _retl(0); else _retl(mkdir(utl_pth)+1); }
CLIPPER MAPISENDMAILC3( void ) { MapiRecipDesc orig ; MapiRecipDesc rcpt ; MapiFileDesc file ; MapiMessage mssg ; orig.ulReserved = 0 ; // Reserved orig.ulRecipClass = MAPI_ORIG ; // Reciepient Class MAPI_TO MAPI_CC MAPI_BCC orig.lpszName = _parc( 4 ) ; // Originator's Name orig.lpszAddress = _parc( 5 ) ; // Originators Address orig.ulEIDSize = 0 ; // Count in bytes of size of pEntryID orig.lpEntryID = NULL ; // System-specific Originator reference rcpt.ulReserved = 0 ; // Reserved rcpt.ulRecipClass = MAPI_TO ; // Reciepient Class MAPI_TO MAPI_CC MAPI_BCC rcpt.lpszName = _parc( 6 ) ; // Reciepient's Name, e.g., [email protected] rcpt.lpszAddress = _parc( 7 ) ; // Reciepient's Address rcpt.ulEIDSize = 0 ; // Count in bytes of size of pEntryID rcpt.lpEntryID = 0 ; // System-specific Recipient reference if( _parinfo(0) >= 8 ) { file.ulReserved = 0 ; // Reserved for future usage file.flFlags = 0 ; // Flags ? file.nPosition = -1 ; // Character of text to be replaced by attachment file.lpszPathName = _parc( 8 ) ; // Full Path Name with Extension of the attached file file.lpszPathName = NULL ; // Full Path Name with Extension of the attached file file.lpszFileName = NULL ; // Original File Name ( optional ) file.lpFileType = NULL ; // Attachment file type ( can be lpMapiFileTagExt ) } mssg.ulReserved = 0 ; // Reserved mssg.lpszSubject = _parc( 2 ) ; // Message Subject mssg.lpszNoteText = _parc( 3 ) ; // Message Text mssg.lpszMessageType = NULL ; // Message Class mssg.lpszDateReceived = NULL ; // in yyyy/mm/dd hh:mm format mssg.lpszConversationID = NULL ; // Conversation thread ID mssg.flFlags = 0 ; // unread, return receipt mssg.lpOriginator = &orig ; // Originator's descriptor mssg.nRecipCount = 1 ; // Number of receipients mssg.lpRecips = &rcpt ; // Recipient descriptors if( _parinfo(0) >= 8 ) { mssg.nFileCount = 1 ; // Number of file attachments mssg.lpFiles = &file ; // Attachment descriptors } else { mssg.nFileCount = 0 ; // Number of file attachments mssg.lpFiles = NULL ; // Attachment descriptors } // to send the mail direcly and without intervenstion //_retnl( (ULONG) MAPISendMail( 0, 0, &mssg, 0, 0 ) ) ; // to opem default mail client's dialog box _retnl( (ULONG) MAPISendMail( 0, 0, &mssg, 8, 0 ) ) ; }
CLIPPER HB_UNDOC2() { char szText[ 25 ]; _retc( "Hello word" ); hb_strncpy( szText, _parc( -1 ), sizeof( szText ) - 1 ); szText[ 5 ] = 0; _retc( szText ); }
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 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 LLIBOPEN( void ){ WORD i; if (PCOUNT() >= 1 && ISCHAR(1) && wLib == 0xffff){ if ((wLib=_topen(_parc(1),0))!=0xffff){ if (ScanLibOffsets()){ _retl(TRUE); return; } } } _retl(FALSE); return; }
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 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); }
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 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 ); } } }
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(); } }
CLIPPER GETHOSTBYN( PARAMS ) // AME( cName ) --> cIPAddress #endif { struct hostent * pHost; BYTE addr[ 20 ]; strcpy( ( char * ) addr, "0.0.0.0" ); pHost = gethostbyname( _parc( 1 ) ); if( pHost ) { wsprintf( ( char * ) addr, "%i.%i.%i.%i", ( BYTE ) pHost->h_addr[ 0 ], ( BYTE ) pHost->h_addr[ 1 ], ( BYTE ) pHost->h_addr[ 2 ], ( BYTE ) pHost->h_addr[ 3 ] ); } _retc( ( char * ) addr ); }
CLIPPER RBINSERTBAND() // hReBar, hControl, cText #endif { HWND hReBar = ( HWND ) _parnl( 1 ); HWND hControl = ( HWND ) _parnl( 2 ); REBARBANDINFO rbinfo; RECT rct; GetWindowRect( hControl, &rct ); _bset( ( char * ) &rbinfo, 0, sizeof( REBARBANDINFO ) ); rbinfo.cbSize = sizeof( REBARBANDINFO ); rbinfo.fMask = RBBIM_TEXT | RBBIM_STYLE | RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE; rbinfo.fStyle = RBBS_CHILDEDGE | RBBS_BREAK; rbinfo.lpText = _parc( 3 ); rbinfo.hwndChild = hControl; rbinfo.cxMinChild = rct.right - rct.left; rbinfo.cyMinChild = rct.bottom - rct.top; rbinfo.cx = rct.right - rct.left; SendMessage( hReBar, RB_INSERTBAND, ( WPARAM ) -1, ( LPARAM ) &rbinfo ); }
CLIPPER GETHOSTBYA( PARAMS ) // DDRESS( cIPAddress ) #endif { LONG lAddr; struct hostent * pHostent; if( ISCHAR( 1 ) ) { lAddr = inet_addr( _parc( 1 ) ); pHostent = gethostbyaddr( ( LPSTR ) &lAddr, 4, PF_INET ); } else { lAddr = _parnl( 1 ); pHostent = gethostbyaddr( ( char * ) &lAddr, 4, PF_INET ); } // if( ( int ) pHostent != INADDR_NONE ) // GPF's with some servers with no associated host name if( pHostent ) // Changed by Jorge Mason, www.htcsoft.cl, Sept.2002 _retc( pHostent->h_name ); else _retc( "Unknown" ); // changed from "" to "unknown" by LKM }
CLIPPER nColorToN() /* funci¢n interface entre Clipper y C */ { _retnl( ucColor2N( _parc( 1 ) ) ); }
CLIPPER SetMChars() { MouseChars( _parc( 1 ) ); }
CLIPPER nColorToN() { _retnl( ucColor2N( _parc( 1 ) ) ); }
CLIPPER HB_STRINGS8() { _storclen( _parc( 2 ), _parnl( 3 ), 1, 1 ); }
CLIPPER HB_STRINGS7() { _storc( _parc( 2 ), 1, 1 ); }
CLIPPER HB_STRINGS3() { _retclen( _parc( 1 ), _parnl( 2 ) ); }
CLIPPER HB_UNDOC12() { _retc( _parc( 1 ) ); _storclen( "CLIPPER power!!!", _parni( 2 ), -1 ); }
CLIPPER HB_UNDOC11() { _retc( _parc( 1 ) ); _storc( "CLIPPER power!!!", -1 ); }
CLIPPER HB_STRINGS2() { _retc( _parc( 1, 1 ) ); }
CLIPPER INET_ADDR( PARAMS ) // cIPAddress --> nAddress #endif { _retnl( inet_addr( _parc( 1 ) ) ); }
CLIPPER HB_STRINGS1() { _retc( _parc( 1 ) ); }