wio_size_t QWrite( f_handle file, void *buffer, wio_size_t len, char *name ) /**************************************************************************/ /* write from far memory */ { wio_size_t h; char rc_buff[RESOURCE_MAX_SIZE]; if( len == 0 ) return( 0 ); #ifdef _INT_DEBUG { wio_off_t pos = QPos(file); if( pos <= SpyWrite && SpyWrite <= pos+len && file == Root->outfile->handle) { DEBUG((DBG_ALWAYS, "About to write to %s (handle %d) %d bytes at position %d:", name, file, len, pos)); PrintMemDump(buffer, len, DUMP_BYTE); } } #endif CheckBreak(); h = write( file, buffer, len ); if( name != NULL ) { if( h == -1 ) { LnkMsg( ERR+MSG_IO_PROBLEM, "12", name, strerror( errno ) ); } else if( h != len ) { Msg_Get( MSG_IOERRLIST_7, rc_buff ); LnkMsg( (FTL+MSG_IO_PROBLEM) & ~OUT_MAP, "12", name, rc_buff ); } } return( h ); }
void initQ(float *Q){ int ind, pop; for(ind=0;ind<NUMINDS;++ind){ for (pop = 0; pop < MAXPOPS; pop++) { Q[QPos (ind, pop)] = (float) 1 / MAXPOPS; } } }
unsigned long QFileSize( f_handle file ) /*********************************************/ { unsigned long curpos; unsigned long size; curpos = QPos( file ); if( TINY_ERROR( TinyLSeek( file, 0L, TIO_SEEK_END, (void __near *)&size ) ) ) size = 0; TinySeek( file, curpos, TIO_SEEK_START ); return( size ); }
static wio_off_t res_pos( WResFileID handle ) /*******************************************/ { return( QPos( handle ) ); }
static off_t ResPos( int handle ) /*******************************/ { return( QPos( handle ) ); }