| 1 |
< |
/* Copyright (c) 1991 Regents of the University of California */ |
| 1 |
> |
/* Copyright (c) 1992 Regents of the University of California */ |
| 2 |
|
|
| 3 |
|
#ifndef lint |
| 4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
| 16 |
|
|
| 17 |
|
#include "resolu.h" |
| 18 |
|
|
| 19 |
+ |
#include "paths.h" |
| 20 |
+ |
|
| 21 |
|
VIEW stdview = STDVIEW; /* default view parameters */ |
| 22 |
|
|
| 23 |
|
|
| 148 |
|
if (d > 1.0) |
| 149 |
|
return(-1); |
| 150 |
|
VCOPY(orig, v->vp); |
| 149 |
– |
if (d <= FTINY) { |
| 150 |
– |
VCOPY(direc, v->vdir); |
| 151 |
– |
return(0); |
| 152 |
– |
} |
| 151 |
|
d = sqrt(d); |
| 152 |
|
z = cos(PI*d); |
| 153 |
< |
d = sqrt(1 - z*z)/d; |
| 153 |
> |
d = d <= FTINY ? PI : sqrt(1 - z*z)/d; |
| 154 |
|
x *= d; |
| 155 |
|
y *= d; |
| 156 |
|
direc[0] = z*v->vdir[0] + x*v->hvec[0] + y*v->vvec[0]; |
| 274 |
|
{ |
| 275 |
|
#define check(c,l) if ((av[0][c]&&av[0][c]!=' ') || \ |
| 276 |
|
badarg(ac-1,av+1,l)) return(-1) |
| 279 |
– |
extern double atof(); |
| 277 |
|
|
| 278 |
|
if (ac <= 0 || av[0][0] != '-' || av[0][1] != 'v') |
| 279 |
|
return(-1); |
| 335 |
|
int na; |
| 336 |
|
int nvopts = 0; |
| 337 |
|
|
| 338 |
< |
while (*s == ' ') |
| 339 |
< |
s++; |
| 338 |
> |
if (*s != '-') |
| 339 |
> |
s = sskip(s); |
| 340 |
|
while (*s) { |
| 341 |
|
ac = 0; |
| 342 |
|
do { |
| 370 |
|
} |
| 371 |
|
|
| 372 |
|
|
| 373 |
< |
static char *altname[] = {NULL,"rpict","rview","pinterp",VIEWSTR,NULL}; |
| 373 |
> |
int |
| 374 |
> |
isview(s) /* is this a view string? */ |
| 375 |
> |
char *s; |
| 376 |
> |
{ |
| 377 |
> |
static char *altname[]={NULL,VIEWSTR,"rpict","rview","pinterp",NULL}; |
| 378 |
> |
extern char *progname; |
| 379 |
> |
register char *cp; |
| 380 |
> |
register char **an; |
| 381 |
> |
/* add program name to list */ |
| 382 |
> |
if (altname[0] == NULL) { |
| 383 |
> |
for (cp = progname; *cp; cp++) |
| 384 |
> |
; |
| 385 |
> |
while (cp > progname && !ISDIRSEP(cp[-1])) |
| 386 |
> |
cp--; |
| 387 |
> |
altname[0] = cp; |
| 388 |
> |
} |
| 389 |
> |
/* skip leading path */ |
| 390 |
> |
cp = s; |
| 391 |
> |
while (*cp && *cp != ' ') |
| 392 |
> |
cp++; |
| 393 |
> |
while (cp > s && !ISDIRSEP(cp[-1])) |
| 394 |
> |
cp--; |
| 395 |
> |
for (an = altname; *an != NULL; an++) |
| 396 |
> |
if (!strncmp(*an, cp, strlen(*an))) |
| 397 |
> |
return(1); |
| 398 |
> |
return(0); |
| 399 |
> |
} |
| 400 |
|
|
| 401 |
+ |
|
| 402 |
|
struct myview { |
| 403 |
|
VIEW *hv; |
| 404 |
|
int ok; |
| 410 |
|
char *s; |
| 411 |
|
register struct myview *v; |
| 412 |
|
{ |
| 413 |
< |
register char **an; |
| 414 |
< |
|
| 391 |
< |
for (an = altname; *an != NULL; an++) |
| 392 |
< |
if (!strncmp(*an, s, strlen(*an))) { |
| 393 |
< |
if (sscanview(v->hv, s+strlen(*an)) > 0) |
| 394 |
< |
v->ok++; |
| 395 |
< |
return; |
| 396 |
< |
} |
| 413 |
> |
if (isview(s) && sscanview(v->hv, s) > 0) |
| 414 |
> |
v->ok++; |
| 415 |
|
} |
| 416 |
|
|
| 417 |
|
|
| 421 |
|
VIEW *vp; |
| 422 |
|
RESOLU *rp; |
| 423 |
|
{ |
| 406 |
– |
extern char *progname; |
| 424 |
|
struct myview mvs; |
| 425 |
|
FILE *fp; |
| 426 |
|
|
| 427 |
|
if ((fp = fopen(fname, "r")) == NULL) |
| 428 |
|
return(-1); |
| 429 |
|
|
| 413 |
– |
altname[0] = progname; |
| 430 |
|
mvs.hv = vp; |
| 431 |
|
mvs.ok = 0; |
| 432 |
|
|