/* vim:set shiftwidth=4 ts=8: */
/*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property
+ * Copyright (c) 2011 AT&T Intellectual Property
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
#endif
#include "adjust.h"
- extern int allow_edits(int);
extern void avoid_cycling(graph_t *, Agnode_t *, double *);
extern int checkStart(graph_t * G, int nG, int);
extern Agnode_t *choose_node(graph_t *, int);
/* vim:set shiftwidth=4 ts=8: */
/*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property
+ * Copyright (c) 2011 AT&T Intellectual Property
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
j = ND_id(v);
GD_dist(G)[i][j] = GD_dist(G)[j][i] = f;
}
-
-int allow_edits(int nsec)
-{
-#ifdef INTERACTIVE
- static int onetime = TRUE;
- static FILE *fp;
- static fd_set fd;
- static struct timeval tv;
-
- char buf[256], name[256];
- double x, y;
- node_t *np;
-
- if (onetime) {
- fp = fopen("/dev/tty", "r");
- if (fp == NULL)
- exit(1);
- setbuf(fp, NULL);
- tv.tv_usec = 0;
- onetime = FALSE;
- }
- tv.tv_sec = nsec;
- FD_ZERO(&fd);
- FD_SET(fileno(fp), &fd);
- if (select(32, &fd, (fd_set *) 0, (fd_set *) 0, &tv) > 0) {
- fgets(buf, sizeof(buf), fp);
- switch (buf[0]) {
- case 'm': /* move node */
- if (sscanf(buf + 1, "%s %lf%lf", name, &x, &y) == 3) {
- np = getnode(G, name);
- if (np) {
- NP_pos(np)[0] = x;
- NP_pos(np)[1] = y;
- diffeq_model();
- }
- }
- break;
- case 'q':
- return FALSE;
- default:
- agerr(AGERR, "unknown command '%s', ignored\n", buf);
- }
- return TRUE;
- }
-#endif
- return FALSE;
-}