示例#1
0
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 );
}
示例#2
0
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;
        }
    }
}
示例#3
0
文件: linkio.c 项目: JWasm/JWlink
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 );
}
示例#4
0
static wio_off_t res_pos( WResFileID handle )
/*******************************************/
{
    return( QPos( handle ) );
}
示例#5
0
文件: linkutil.c 项目: JWasm/JWlink
static off_t ResPos( int handle )
/*******************************/
{
    return( QPos( handle ) );
}