ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/mgflib/parser.c
(Generate patch)

Comparing ray/src/cv/mgflib/parser.c (file contents):
Revision 1.15 by greg, Thu Apr 13 12:11:30 1995 UTC vs.
Revision 1.16 by greg, Tue Apr 18 15:53:26 1995 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1994 Regents of the University of California */
1 > /* Copyright (c) 1995 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 219 | Line 219 | register MG_FCTXT      *ctx;
219   char    *fn;
220   {
221          static int      nfids;
222        int     olen;
222          register char   *cp;
223  
224          ctx->fid = ++nfids;
# Line 232 | Line 231 | char   *fn;
231                  return(MG_OK);
232          }
233                                          /* get name relative to this context */
234 <        if (mg_file != NULL &&
236 <                        (cp = strrchr(mg_file->fname, '/')) != NULL)
237 <                olen = cp - mg_file->fname + 1;
238 <        else
239 <                olen = 0;
240 <        if (olen)
234 >        if (mg_file != NULL && (cp = strrchr(mg_file->fname, '/')) != NULL) {
235                  strcpy(ctx->fname, mg_file->fname);
236 <        strcpy(ctx->fname+olen, fn);
236 >                strcpy(ctx->fname+(cp-mg_file->fname+1), fn);
237 >        } else
238 >                strcpy(ctx->fname, fn);
239          ctx->fp = fopen(ctx->fname, "r");
240          if (ctx->fp == NULL)
241                  return(MG_ENOFILE);
# Line 390 | Line 386 | char   **av;
386   {
387          char    *xfarg[MG_MAXARGC];
388          MG_FCTXT        ictx;
389 +        XF_SPEC *xf_orig = xf_context;
390          int     rv;
391  
392          if (ac < 2)
# Line 406 | Line 403 | char   **av;
403                  if ((rv = mg_handle(MG_E_XF, ac-1, xfarg)) != MG_OK)
404                          return(rv);
405          }
406 <        while (!feof(mg_file->fp)) {
406 >        do {
407                  while (mg_read())
408                          if ((rv = mg_parse()) != MG_OK) {
409                                  fprintf(stderr, "%s: %d: %s:\n%s", ictx.fname,
# Line 418 | Line 415 | char   **av;
415                  if (ac > 2)
416                          if ((rv = mg_handle(MG_E_XF, 1, xfarg)) != MG_OK)
417                                  return(rv);
418 <        }
418 >        } while (xf_context != xf_orig);
419          mg_close();
420          return(MG_OK);
421   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines