예제 #1
0
파일: gen.c 프로젝트: berkus/lang-e
/* 
 * Links fragment and returns size of fragment (in bytes).
 */
int v_end_incremental(void) {
        int nbytes;

        v_link();
        v_nop(); v_nop(); v_nop(); v_nop();
        nbytes = (char *)v_stop() - (char *)frag_begin;
        if(nbytes > frag_bytes) 
                v_fatal("v_end_incremental: buffer overflow\n");
        v_flushcache(frag_begin, nbytes);
	v_incremental = 0;
        return nbytes;
}
예제 #2
0
/* HandleCache()
 * ===================================================================
 */
int
HandleCache( int button, WORD *msg )
{
    int   quit;
    int	 out;
    int   error;

    quit   = FALSE;


    /* Handle Double-clicking of the objects */
    if( ( button != -1 ) && ( button & 0x8000 ) )
        button &= 0x7FFF;

    switch( button )
    {
    case CCANCEL:
        Current.SpeedoCacheSize = OldSpeedoCache;
        Current.speedo_percent  = OldPercent;
        Current.BitMapCacheSize = OldBitMapSize;

    case C*K:
        Deselect( button );
        if( button == C*K )
        {
            DoValuesCheck();
            CacheCheck();
        }

        Reset_Tree( ad_options );
        Objc_draw( tree, ROOT, MAX_DEPTH, NULL );
        break;

    case LCACHE:
    case MCACHE:
    case SCACHE:
        if( SpeedoFlag )
        {
            sprintf( cache_path, "%s\\", OutlinePath );

            out = fsel_name( FALSE, cache_path, "*.SPC", cache_text[ button - LCACHE ] );

            if( ( ( out == A_OK ) || ( out == A_CANCEL )) && ( cache_path[0] != '\0' ) )
            {
                if( out == A_OK )
                {
                    /* Check if the file exists first */
                    if(( button == LCACHE ) || ( button == MCACHE ))
                    {
                        olddma = Fgetdta();
                        Fsetdta( &newdma );		/* Point to OUR buffer */

                        error = Fsfirst( cache_path, 0 );/* Normal file search for 1st file */
                        if( error != E_OK )	/* No such files! */
                        {
                            Fsetdta( olddma );	/* Point to OLD buffer */
                            form_alert( 1, nofile );
                            XDeselect( tree, button );
                            return( quit );
                        }
                    }

                    if( open_vwork() )
                    {
                        switch( button )
                        {
                        case LCACHE:
                            out = v_loadcache( vhandle, cache_path, TRUE );
                            break;

                        case MCACHE:
                            out = v_loadcache( vhandle, cache_path, FALSE ); /* append, merge */
                            break;

                        case SCACHE:
                            out = v_savecache( vhandle, cache_path );
                            break;
                        default:
                            break;
                        }
                        if( out == -1 )
                            form_alert( 1, alert19 );
                        close_vwork();

                    }
                    else
                        form_alert( 1, alert18 );
                }
            }
            Calc_Cache( TRUE );
        }
        XDeselect( tree, button );
        break;

    case CCACHE:
        if( SpeedoFlag )
        {
            if( form_alert( 1, alert17 ) == 1 )
            {
                if( open_vwork())
                {
                    if( v_flushcache( vhandle ) == -1 )
                        form_alert( 1, alert19 );
                    close_vwork();
                }
                else
                    form_alert( 1, alert18 );
                Calc_Cache( TRUE );
            }
        }
        XDeselect( tree, button );
        break;


    case MUP:
    case MDOWN:
        Up_Down_Arrow( button, MUP, &MiscSizeText[0], &mcache, MSIZE );
        break;

    case BUP:
    case BDOWN:
        Up_Down_Arrow( button, BUP, &BitSizeText[0], &Current.BitMapCacheSize, BSIZE );
        break;

    case CUP:
    case CDOWN:
        Up_Down_Arrow( button, CUP, &CharSizeText[0], &ccache, CSIZE );
        break;

    default:
        if( button == -1 )
        {
            switch( msg[0] )
            {
            case WM_REDRAW:
                break;

            case AC_CLOSE:
                quit = TRUE;
                break;

            case WM_CLOSED:
                quit = TRUE;
                DoValuesCheck();
                CloseWindow();
                break;

            case CT_KEY:
                break;
            default:
                break;
            }
        }
        break;
    }
    return( quit );


}