コード例 #1
0
ファイル: objstrip.c プロジェクト: ABratovic/open-watcom-v2
void AddEdge( segdata * seg, symbol * sym )
/************************************************/
/* reference from a segment to a symbol */
{
    edgelist *  edge;

    if( sym->info & SYM_DEFINED ) {
        if( !IS_SYM_IMPORTED(sym) && seg != sym->p.seg && sym->p.seg != NULL ) {
            if( seg->isrefd || !seg->iscode ) {
                RefSeg( sym->p.seg );
            } else if( !sym->p.seg->isrefd ) {
                edge = AllocEdge();
                edge->u.seg = sym->p.seg;
                edge->issym = FALSE;
                edge->next = seg->a.refs;
                seg->a.refs = edge;
            }
        }
    } else {    /* symbol is undefined */
        if( seg->isrefd || !seg->iscode ) {
            sym->info |= SYM_DCE_REF;
            PruneNonSymEdges( sym );
        } else {
            edge = AllocEdge();
            edge->u.seg = seg;
            edge->next = sym->p.edges;
            edge->issym = FALSE;
            edge->reverse_dir = TRUE;
            sym->p.edges = edge;
        }
    }
}
コード例 #2
0
ファイル: optimize.cpp プロジェクト: BielBdeLuna/StormEngine2
/*
====================
TryAddNewEdge

====================
*/
static	bool TryAddNewEdge( optVertex_t *v1, optVertex_t *v2, optIsland_t *island ) {
	optEdge_t	*e;

	// if the new edge crosses any other edges, don't add it
	for ( e = island->edges ; e ; e = e->islandLink ) {
		if ( EdgesCross( e->v1, e->v2, v1, v2 ) ) {
			return false;
		}
	}

	if ( dmapGlobals.drawflag ) {
		qglBegin( GL_LINES );
		qglColor3f( 0, ( 128 + orandom.RandomInt( 127 ) )/ 255.0, 0 );
		qglVertex3fv( v1->pv.ToFloatPtr() );
		qglVertex3fv( v2->pv.ToFloatPtr() );
		qglEnd();
		qglFlush();
	}
	// add it
	e = AllocEdge();

	e->islandLink = island->edges;
	island->edges = e;
	e->v1 = v1;
	e->v2 = v2;

	e->created = true;

	// link the edge to its verts
	LinkEdge( e );

	return true;
}
コード例 #3
0
ファイル: optimize.cpp プロジェクト: BielBdeLuna/StormEngine2
/*
=================
AddEdgeIfNotAlready
=================
*/
void AddEdgeIfNotAlready( optVertex_t *v1, optVertex_t *v2 ) {
	optEdge_t	*e;

	// make sure that there isn't an identical edge already added
	for ( e = v1->edges ; e ; ) {
		if ( ( e->v1 == v1 && e->v2 == v2 ) || ( e->v1 == v2 && e->v2 == v1 ) ) {
			return;		// already added
		}
		if ( e->v1 == v1 ) {
			e = e->v1link;
		} else if ( e->v2 == v1 ) {
			e = e->v2link;
		} else {
			common->Error( "SplitEdgeByList: bad edge link" );
		}
	}

	// this edge is a keeper
	e = AllocEdge();
	e->v1 = v1;
	e->v2 = v2;

	e->islandLink = NULL;

	// link the edge to its verts
	LinkEdge( e );
}
コード例 #4
0
ファイル: objstrip.c プロジェクト: ABratovic/open-watcom-v2
void AddSymEdge( symbol * srcsym, symbol * targsym )
/*********************************************************/
/* make a reference from one symbol to another */
{
    edgelist *  edge;

    if( srcsym->info & SYM_DEFINED ) {
        AddEdge( srcsym->p.seg, targsym );
    } else {
        edge = AllocEdge();
        edge->u.sym = targsym;
        edge->issym = TRUE;
        edge->next = srcsym->p.edges;
        srcsym->p.edges = edge;
    }
}
コード例 #5
0
ファイル: objstrip.c プロジェクト: ABratovic/open-watcom-v2
void AddSymSegEdge( symbol *srcsym, segdata *targsdata )
/*********************************************************/
/* make a reference from symbol to segment */
{
    edgelist *  edge;

    if( IS_SYM_IMPORTED(srcsym) ) {
        RefSeg(targsdata);
        return;
    }
    edge = AllocEdge();
    edge->u.seg = targsdata;
    edge->issym = FALSE;
    if( srcsym->info & SYM_DEFINED ) {
        edge->next = targsdata->a.refs;
        targsdata->a.refs = edge;
    } else {
        edge->next = srcsym->p.edges;
        srcsym->p.edges = edge;
    }
}