static char *SccsId = "@(#)str_mc.c 3.1 (TU-Delft) 04/16/87";
/**********************************************************

Name/Version      : sldm/3.1

Language          : C
Operating system  : UNIX SYSTEM V
Host machine      : HP9000

Author(s)         : N. van der Meijs
Creation date     : 17-Oct-1984
Modified by       :
Modification date :


        Delft University of Technology
        Department of Electrical Engineering
        Network Theory Section
        Mekelweg 4 - P.O.Box 5031
        2600 GA DELFT
        The Netherlands

        Phone : 015 - 786234

        COPYRIGHT (C) 1984 , All rights reserved
**********************************************************/
# include "sldm.h"

/* stretchMc - stretch a mc if needed */

stretchMc (mp)
MC * mp;
{
    int         dx = 0,
                dy = 0,
                 i = 0,		/* loop variabele */
            result = OK;	/* return value */
    STRETCH        * sp;	/* addres of STRETCH node, all nodes are
				   processed in loop */
    STRETCH * lookup  ();
    void      printMc ();

    while ((sp = lookup (i++, XDIR)) != NULL) {
	if (sp -> pos <= mp -> tx &&
		sp -> lo < mp -> ty && sp -> hi > mp -> ty)
	    dx += sp -> val;
    }

    i = 0;

    while ((sp = lookup (i++, YDIR)) != NULL) {
	if (sp -> pos <= mp -> ty &&
		sp -> lo < mp -> tx && sp -> hi > mp -> tx)
	    dy += sp -> val;
    }

    mp -> tx += dx;
    mp -> ty += dy;
    printMc (mp);
    return (result);
}
