static char *SccsId = "@(#)input.c 4.3 (TU-Delft) 5/1/92";
/**********************************************************

Name/Version      : mplot/4.3

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

Author            : N.P. van der Meijs
Creation date     : 15-Mar-1988
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) 1988. All rights reserved.
**********************************************************/
#include <stdio.h>
#include "dmincl.h"
#include "config.h"
#include "plot.h"
#include "aux/aux.h"
/*
#include "aux/dmescape.h"
*/

static DM_STREAM * stream = NULL;
extern DM_STREAM * dmOpenStream ();

openInput (cellKey, mask)
DM_CELL * cellKey;
char * mask;
{
    stream = dmOpenStream (cellKey, mprintf ("%s_gln", mask), "r");
}

closeInput ()
{
    dmCloseStream (stream, COMPLETE), stream = NULL;
}

edge_t * fetch ()
{
    int k;
    edge_t * edge;

    edge = NEW (edge_t, 1);
    edge -> fwd = edge -> bwd = NULL;
    edge -> contour = edge -> link = NULL;

    k = dmGetDesignData (stream, GEO_GLN);
    if (k > 0) {
	edge -> xl = ggln.xl, edge -> xr = ggln.xr;
	edge -> yl = ggln.yl, edge -> yr = ggln.yr;
    }
    else if (k == 0) { /* EOF */
	edge -> xl =  INF, edge -> xr = INF;
	edge -> yl =  INF, edge -> yr = INF;
    }
    else say ("read error"), die ();

    return (edge);
}

printEdge (s, edge)
char * s;
edge_t * edge;
{
    fprintf (stderr, "%s: xl=%d yl=%d xr=%d yr=%d\n",
	s, edge -> xl, edge -> yl, edge -> xr, edge -> yr);
}
