Пример #1
0
static int DoOpen( char *name, unsigned mode, bool isexe )
/********************************************************/
{
    int     h;
    int     perm;

    CheckBreak();
    mode |= O_BINARY;
    perm = PMODE_RW;
    if( isexe )
        perm = PMODE_RWX;
    for( ;; ) {
        if( OpenFiles >= MAX_OPEN_FILES )
            CleanCachedHandles();
        h = open( name, mode, perm );
        if( h != -1 ) {
            OpenFiles++;
            break;
        }
        if( errno != TOOMANY )
            break;
        if( !CleanCachedHandles() ) {
            break;
        }
    }
    return( h );
}
Пример #2
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 );
}
Пример #3
0
static void ForStatement(void)
{
	Int32 l1,l2,l3,l4;
	
	SkipToken(tFOR);
	SkipToken(tLPAREN);
	
	/* init */
	if( Token != tSEMI )
	{
		AssignmentStatement();
        while( Token==tCOMMA )
        {
            SkipToken(tCOMMA);
    		AssignmentStatement();    
        }
	}
	SkipToken(tSEMI);
	
	/* cond */
	l1 = vm_addr();
    if( Token != tSEMI )
    {
	    Expr();
    }
    else
    {
    	vm_genI(op_pushint,1);
    }
	l2 = vm_genI(op_jnz,0);
	l3 = vm_genI(op_jmp,0);
	
	/* incr */
	SkipToken(tSEMI);
	vm_patch(l3,vm_addr());
	l4 = vm_addr();
    if( Token != tRPAREN )
    {
	    AssignmentStatement();
        while( Token==tCOMMA )
        {
            SkipToken(tCOMMA);
            AssignmentStatement();
        }
    }
	vm_genI(op_jmp,l1);
	
	/* statements */
	SkipToken(tRPAREN);
	vm_patch(l2,vm_addr());
	StatementList();
	vm_genI(op_jmp,l4);
	
	/* done */
	vm_patch(l3,vm_addr());
	CheckBreak();
	
	SkipToken(tEND);
}
Пример #4
0
void WriteStdOut( char *str )
/**********************************/
{
    CheckBreak();
    if( IdeCB != NULL ) {
        IdeCB->PrintWithCRLF( IdeHdl, str );
    }
}
Пример #5
0
unsigned long QPos( f_handle file )
/****************************************/
{
    unsigned long pos;

    CheckBreak();
    if( TINY_ERROR( TinyLSeek( file, 0L, TIO_SEEK_CURR, (void __near *)&pos ) ) ) {
        return( -1L );
    }
    return( pos );
}
Пример #6
0
void QClose( f_handle file, char *name )
/*********************************************/
/* file close */
{
    tiny_ret_t h;

    CheckBreak();
    h = TinyClose( file );
    OpenFiles--;
    if( TINY_OK( h ) || name == NULL ) return;
    LnkMsg( ERR+MSG_IO_PROBLEM, "12", name, QErrMsg( TINY_INFO( h ) ) );
}
Пример #7
0
wio_off_t QLSeek( f_handle file, wio_off_t position, int start, char *name )
/***********************************************************************/
{
    wio_off_t   h;

    CheckBreak();
    h = lseek( file, position, start );
    if( h == -1 && name != NULL ) {
        LnkMsg( ERR+MSG_IO_PROBLEM, "12", name, strerror( errno ) );
    }
    return( h );
}
HRESULT COpenCallbackConsole::CryptoGetTextPassword(BSTR *password)
{
  PasswordWasAsked = true;
  RINOK(CheckBreak());
  if (!PasswordIsDefined)
  {
    Password = GetPassword(OutStream); 
    PasswordIsDefined = true;
  }
  CMyComBSTR temp(Password);
  *password = temp.Detach();
  return S_OK;
}
Пример #9
0
void QClose( f_handle file, char *name )
/*********************************************/
/* file close */
{
    int         h;

    CheckBreak();
    h = close( file );
    OpenFiles--;
    if( h != -1 )
        return;
    LnkMsg( ERR+MSG_IO_PROBLEM, "12", name, strerror( errno ) );
}
Пример #10
0
wio_size_t QRead( f_handle file, void *buffer, wio_size_t len, char *name )
/*************************************************************************/
/* read into far memory */
{
    wio_size_t  h;

    CheckBreak();
    h = read( file, buffer, len );
    if( h == -1 ) {
        LnkMsg( ERR+MSG_IO_PROBLEM, "12", name, strerror( errno ) );
    }
    return( h );
}
Пример #11
0
long QLSeek( f_handle file, long position, int start, char *name )
/***********************************************************************/
{
    tiny_ret_t    rc;
    unsigned long pos;

    CheckBreak();
    rc = TinyLSeek( file, position, start, (void __near *)&pos );
    if( TINY_ERROR( rc ) ) {
        if( name != NULL )
            LnkMsg( ERR+MSG_IO_PROBLEM, "12", name, QErrMsg( TINY_INFO( rc ) ) );
        return( -1L );   /* for xmem checking */
    }
    return( pos );
}
Пример #12
0
static void UntilStatement(void)
{
	Int32 l1,l2;

	SkipToken(tUNTIL);

	l1 = vm_addr();
	Expr();
	if( Token==tDO ) NextToken();
	l2 = vm_genI(op_jnz,0);
	StatementList();
	vm_genI(op_jmp,l1);
	vm_patch(l2,vm_addr());
	CheckBreak();
	
	SkipToken(tEND);
}
Пример #13
0
unsigned QRead( f_handle file, void *buffer, unsigned len, char *name )
/****************************************************************************/
/* read into far memory */
{
    tiny_ret_t   h;

    CheckBreak();
    h = TinyRead( file, buffer, len );
    if( TINY_ERROR( h ) ) {
        if( name != NULL ) {
            LnkMsg( ERR+MSG_IO_PROBLEM, "12", name, QErrMsg( TINY_INFO( h ) ) );
        } else {
            return( -1 );
        }
    }
    return( TINY_INFO(h) );

}
Пример #14
0
void WriteStdOutInfo( char *str, unsigned level, char *symbol )
/********************************************************************/
{
    IDEMsgInfo  info;
    unsigned    msgclass;

    CheckBreak();
    if( IdeCB != NULL ) {
        IdeMsgInit( &info, SeverityMap[(level & CLASS_MSK) >> NUM_SHIFT], str );
        msgclass = level & CLASS_MSK;
        if( msgclass != BANNER && msgclass >= (WRN & CLASS_MSK) ) {
            IdeMsgSetMsgNo( &info, CalcMsgNum( level ) );
            IdeMsgSetHelp( &info, "wlnkerrs.hlp", level & NUM_MSK );
        }
        if( symbol != NULL ) {
            IdeMsgSetLnkSymbol( &info, symbol );
        }
        IdeCB->PrintWithInfo( IdeHdl, &info );
    }
Пример #15
0
static tiny_ret_t DoOpen( char *name, bool create, unsigned mode )
/****************************************************************/
{
    tiny_ret_t       h;

    CheckBreak();
    for( ;; ) {
        if( OpenFiles >= MAX_OPEN_FILES ) CleanCachedHandles();
        if( create ) {
            h  = TinyCreate( name, mode );
        } else {
            h = TinyOpen( name, mode );
        }
        if( TINY_OK( h ) ) {
            OpenFiles++;
            break;
        }
        if( TINY_INFO( h ) != TOOMANY ) break;
        if( !CleanCachedHandles() ) break;
    }
    return( h );
}
Пример #16
0
static unsigned TestWrite( f_handle file, void *buffer, unsigned len, char *name )
/*****************************************************************************/
{
    tiny_ret_t  h;
    char        rc_buff[RESOURCE_MAX_SIZE];

    CheckBreak();
    if( len == 0 ) return( 0 );

    h = TinyWrite( file, buffer, len );
    if( name != NULL ) {
        if( TINY_ERROR( h ) ) {
            LnkMsg( ERR+MSG_IO_PROBLEM, "12", name, QErrMsg( TINY_INFO( h ) ) );
            return( ~0 );
        } else if( TINY_INFO( h ) != len ) {
            if( name != NULL ) {
                Msg_Get( MSG_IOERRLIST_7, rc_buff );
                LnkMsg( (FTL+MSG_IO_PROBLEM) & ~OUT_MAP, "12", name, rc_buff );
            }
        }
    }
    return( TINY_INFO(h) );
}
Пример #17
0
static int DoOpen( char *name, unsigned mode, bool isexe )
/********************************************************/
{
    int     h;

    isexe = isexe;
    CheckBreak();
    mode |= O_BINARY;
    for( ;; ) {
        if( OpenFiles >= MAX_OPEN_FILES )
            CleanCachedHandles();
        h = open( name, mode, S_IRUSR | S_IWUSR );
        if( h != -1 ) {
            OpenFiles++;
            break;
        }
        if( errno != TOOMANY )
            break;
        if( !CleanCachedHandles() ) {
            break;
        }
    }
    return( h );
}
Пример #18
0
wio_off_t QPos( f_handle file )
/****************************************/
{
    CheckBreak();
    return( lseek( file, 0L, SEEK_CUR ) );
}
HRESULT COpenCallbackConsole::SetTotal(const UInt64 *, const UInt64 *)
{
  return CheckBreak();
}
Пример #20
0
unsigned long QPos( f_handle file )
/*********************************/
{
    CheckBreak();
    return( lseek( file, 0L, SEEK_CUR ) );
}
HRESULT COpenCallbackConsole::SetCompleted(const UInt64 *, const UInt64 *)
{
  return CheckBreak();
}