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 SOCKETSEND( PARAMS ) // nSocket, cText --> nResult #endif { WORD wLen = _parclen( 2 ); if( wLen > 32350 ) wLen = 32350; _retni( _send( _parni( 1 ), _parc( 2 ), wLen, 0 ) ); }
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 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 HB_STRINGS4() { _retni( _parclen( 1 ) ); }
CLIPPER HB_UNDOC3() { _retc( "Hello word" ); _retnl( _parclen( -1 ) ); }
CLIPPER a_rjs_prnt(void) { static unsigned char printer_type; /* bit assignments for print station */ static unsigned int text_len; /* data length */ static char *data; /* data pointer */ static int line_feed; /* line feed flag */ static int next_buff_in; /* next buffer input index */ /* validate parameters */ if (PCOUNT == 5 && ISNUM(RCPT) && ISNUM(JRNAL) && ISNUM(SLIP) && ISCHAR(TXT) && ISNUM(LINE_FLAG)) { if (!async_printing) /* not in asynchronous printing mode */ { _retni(INVP); return; } data = _parc(TXT); /* get data to be printed */ /* check data length */ text_len = _parclen(TXT); if (NOT_IN_RANGE(text_len, 1, 80)) { _retni(INVP); return; } /* determine printer station */ printer_type = 0x00; if (_parni(JRNAL)) printer_type |= 0x01; /* print on journal */ if (_parni(RCPT)) printer_type |= 0x02; /* print on receipt */ if (_parni(SLIP)) printer_type |= 0x04; /* print on slip/document */ if (printer_type == 0x04) /* slip validation not supported */ { _retni(INVP); return; } if (printer_type == 0) /* no printer assignment */ printer_type = 0x02; /* default to receipt */ /* only one printer station at a time */ if (((printer_type & 0x02) && (printer_type & 0x04)) || ((printer_type & 0x01) && (printer_type & 0x04))) { _retni(INVP); return; } /* get line feed flag */ line_feed = _parni(LINE_FLAG); /* verify initial status */ if (chk_init_flag(POS_PRINTER) == 0) { _retni(DEV_NOT_EXIST); /* device not yet initialized */ return; } /* buffer the print job */ next_buff_in = buff_in1; /* get current buffer input index */ ++next_buff_in; if (next_buff_in == PRINT_JOBS) /* past the end of buffer ? */ next_buff_in = 0; /* reset to start of buffer */ if (next_buff_in == buff_out1) /* is the buffer full ? */ { _retni(MEM_OUT); return; } prnt_data1[buff_in1].func_type = 0; /* A_RJS_PRNT() */ prnt_data1[buff_in1].printer_type = printer_type; prnt_data1[buff_in1].line_flag = line_feed; prnt_data1[buff_in1].text_len = text_len; _bcopy(prnt_data1[buff_in1].txt_msg, data,text_len); buff_in1 = next_buff_in; /* update buffer input index */ buffer_empty = 0; /* buffer is not empty */ _retni(NORMAL); } else _retni(INVP); }
CLIPPER HB_STOD( void ) { /* The length check is a fix to avoid buggy behaviour of _retds() */ _retds( ( ISCHAR( 1 ) && _parclen( 1 ) == 8 ) ? _parc( 1 ) : " " ); }