/* parse.f -- translated by f2c (version 20061008). You must link the resulting object file with libf2c: on Microsoft Windows system, link with libf2c.lib; on Linux or Unix systems, link with .../path/to/libf2c.a -lm or, if you install libf2c.a in a standard place, with -lf2c -lm -- in that order, at the end of the command line, as in cc *.o -lf2c -lm Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., http://www.netlib.org/f2c/libf2c.zip */ #include "f2c.h" /* Common Block Declarations */ struct { real fontscale, gamma, zoom; integer nscheme, shadowflag, xbg; shortint nax, nay, otmode, quality; shortlogical invert, lflag; } options_; #define options_1 options_ struct { integer assout; logical verbose; } asscom_; #define asscom_1 asscom_ struct { integer ntx, nty, npx, npy; } raster_; #define raster_1 raster_ /* Table of constant values */ static integer c__4 = 4; static integer c__1 = 1; static integer c__2 = 2; static integer c__0 = 0; /* Subroutine */ int parse_(void) { /* System generated locals */ integer i__1, i__2; icilist ici__1; /* Builtin functions */ /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); integer s_rsli(icilist *), do_lio(integer *, integer *, char *, ftnlen), e_rsli(void), s_cmp(char *, char *, ftnlen, ftnlen), s_rsfi( icilist *), do_fio(integer *, char *, ftnlen), e_rsfi(void), s_wsfe(cilist *), e_wsfe(void); /* Local variables */ static integer k; static char labelfile[64]; static integer iarg, larg, kbrk; static char args[64*4]; extern integer iargc_(void), local_(integer *, char *, char *, char *, char *, ftnlen, ftnlen, ftnlen, ftnlen); static integer nargs; extern /* Subroutine */ int lopen_(char *, ftnlen), getarg_(integer *, char *, ftnlen), getenv_(char *, char *, ftnlen, ftnlen); static char option[64]; /* Fortran I/O blocks */ static icilist io___4 = { 1, option, 1, 0, 64, 1 }; static icilist io___7 = { 1, option, 1, 0, 64, 1 }; static icilist io___11 = { 1, option, 1, 0, 64, 1 }; static icilist io___12 = { 1, option, 1, 0, 64, 1 }; static icilist io___13 = { 0, option+1, 0, "(1Z6)", 6, 1 }; static cilist io___14 = { 0, 0, 0, "(1Z12)", 0 }; /* Version 2.7c */ for (larg = 1; larg <= 4; ++larg) { s_copy(args + (larg - 1 << 6), " ", (ftnlen)64, (ftnlen)1); } larg = 0; asscom_1.verbose = FALSE_; options_1.nax = -1; options_1.nay = -1; options_1.nscheme = -1; options_1.shadowflag = -1; options_1.xbg = 0; options_1.quality = 90; options_1.lflag = FALSE_; options_1.zoom = 0.f; options_1.gamma = 1.f; /* Default font scale is 3.0 (appropriate for 300 dpi printers) */ /* This is superseded by the environmental variable FONTSCALE */ /* or a specific command line options -fontscale XX */ getenv_("FONTSCALE", option, (ftnlen)9, (ftnlen)64); i__1 = s_rsli(&io___4); if (i__1 != 0) { goto L8; } i__1 = do_lio(&c__4, &c__1, (char *)&options_1.fontscale, (ftnlen)sizeof( real)); if (i__1 != 0) { goto L8; } i__1 = e_rsli(); if (i__1 != 0) { goto L8; } goto L9; L8: options_1.fontscale = 3.f; L9: iarg = 1; nargs = iargc_(); L10: if (iarg > nargs) { goto L11; } getarg_(&iarg, option, (ftnlen)64); if (s_cmp(option, "-debug", (ftnlen)6, (ftnlen)6) == 0) { asscom_1.verbose = TRUE_; } else if (s_cmp(option, "-aa", (ftnlen)3, (ftnlen)3) == 0) { if (*(unsigned char *)&option[3] == '0') { options_1.nscheme = 0; } else if (*(unsigned char *)&option[3] == '1') { options_1.nscheme = 1; } else { options_1.nscheme = 4; } } else if (s_cmp(option, "-draft", (ftnlen)6, (ftnlen)6) == 0) { options_1.nscheme = 1; } else if (s_cmp(option, "-alpha", (ftnlen)6, (ftnlen)6) == 0) { options_1.nscheme = 0; } else if (s_cmp(option, "-transp", (ftnlen)7, (ftnlen)7) == 0) { options_1.nscheme = 0; } else if (s_cmp(option, "-qual", (ftnlen)5, (ftnlen)5) == 0) { ++iarg; getarg_(&iarg, option, (ftnlen)64); i__1 = s_rsli(&io___7); if (i__1 != 0) { goto L10; } i__1 = do_lio(&c__2, &c__1, (char *)&options_1.quality, (ftnlen) sizeof(shortint)); if (i__1 != 0) { goto L10; } i__1 = e_rsli(); if (i__1 != 0) { goto L10; } if (options_1.quality <= 0 || options_1.quality > 100) { options_1.quality = 95; } } else if (s_cmp(option, "-size", (ftnlen)5, (ftnlen)5) == 0) { ++iarg; getarg_(&iarg, option, (ftnlen)64); kbrk = 2; for (k = 15; k >= 2; --k) { if (*(unsigned char *)&option[k - 1] == 'x') { kbrk = k; } if (*(unsigned char *)&option[k - 1] == 'X') { kbrk = k; } } ici__1.icierr = 1; ici__1.iciend = 1; ici__1.icirnum = 1; ici__1.icirlen = kbrk - 1; ici__1.iciunit = option; ici__1.icifmt = 0; i__1 = s_rsli(&ici__1); if (i__1 != 0) { goto L10; } i__1 = do_lio(&c__2, &c__1, (char *)&options_1.nax, (ftnlen)sizeof( shortint)); if (i__1 != 0) { goto L10; } i__1 = e_rsli(); if (i__1 != 0) { goto L10; } i__2 = kbrk; ici__1.icierr = 1; ici__1.iciend = 1; ici__1.icirnum = 1; ici__1.icirlen = 15 - i__2; ici__1.iciunit = option + i__2; ici__1.icifmt = 0; i__1 = s_rsli(&ici__1); if (i__1 != 0) { goto L10; } i__1 = do_lio(&c__2, &c__1, (char *)&options_1.nay, (ftnlen)sizeof( shortint)); if (i__1 != 0) { goto L10; } i__1 = e_rsli(); if (i__1 != 0) { goto L10; } if (options_1.nscheme < 0) { options_1.nscheme = -4; } } else if (s_cmp(option, "-label", (ftnlen)6, (ftnlen)6) == 0) { options_1.lflag = TRUE_; i__1 = iarg + 1; getarg_(&i__1, option, (ftnlen)64); if (iarg < nargs && *(unsigned char *)option != '-') { s_copy(labelfile, option, (ftnlen)64, (ftnlen)64); ++iarg; } else { s_copy(labelfile, "label3d.ps", (ftnlen)64, (ftnlen)10); } } else if (s_cmp(option, "-fontscale", (ftnlen)10, (ftnlen)10) == 0) { ++iarg; getarg_(&iarg, option, (ftnlen)64); i__1 = s_rsli(&io___11); if (i__1 != 0) { goto L10; } i__1 = do_lio(&c__4, &c__1, (char *)&options_1.fontscale, (ftnlen) sizeof(real)); if (i__1 != 0) { goto L10; } i__1 = e_rsli(); if (i__1 != 0) { goto L10; } if (options_1.fontscale <= 0.f) { options_1.fontscale = 3.f; } } else if (s_cmp(option, "-gamma", (ftnlen)10, (ftnlen)6) == 0) { ++iarg; getarg_(&iarg, option, (ftnlen)64); i__1 = s_rsli(&io___12); if (i__1 != 0) { goto L10; } i__1 = do_lio(&c__4, &c__1, (char *)&options_1.gamma, (ftnlen)sizeof( real)); if (i__1 != 0) { goto L10; } i__1 = e_rsli(); if (i__1 != 0) { goto L10; } if (options_1.gamma <= 0.f) { options_1.gamma = 1.f; } } else if (s_cmp(option, "-zoom", (ftnlen)5, (ftnlen)5) == 0) { ++iarg; getarg_(&iarg, option, (ftnlen)64); kbrk = 15; for (k = 15; k >= 2; --k) { if (*(unsigned char *)&option[k - 1] == '%') { kbrk = k; } } ici__1.icierr = 1; ici__1.iciend = 1; ici__1.icirnum = 1; ici__1.icirlen = kbrk - 1; ici__1.iciunit = option; ici__1.icifmt = 0; i__1 = s_rsli(&ici__1); if (i__1 != 0) { goto L10; } i__1 = do_lio(&c__4, &c__1, (char *)&options_1.zoom, (ftnlen)sizeof( real)); if (i__1 != 0) { goto L10; } i__1 = e_rsli(); if (i__1 != 0) { goto L10; } if (options_1.zoom <= 0.f) { options_1.zoom = 0.f; } if (*(unsigned char *)&option[kbrk - 1] == '%') { options_1.zoom = -options_1.zoom; } } else if (s_cmp(option, "-shadow", (ftnlen)7, (ftnlen)7) == 0) { options_1.shadowflag = 1; } else if (s_cmp(option, "-noshadow", (ftnlen)9, (ftnlen)9) == 0) { options_1.shadowflag = 0; } else if (s_cmp(option, "-bg", (ftnlen)3, (ftnlen)3) == 0) { ++iarg; getarg_(&iarg, option, (ftnlen)64); if (s_cmp(option, "white", (ftnlen)5, (ftnlen)5) == 0) { options_1.xbg = -1; } if (s_cmp(option, "black", (ftnlen)5, (ftnlen)5) == 0) { options_1.xbg = -16777216; } if (*(unsigned char *)option == '#') { s_rsfi(&io___13); do_fio(&c__1, (char *)&options_1.xbg, (ftnlen)sizeof(integer)); e_rsfi(); s_wsfe(&io___14); do_fio(&c__1, (char *)&options_1.xbg, (ftnlen)sizeof(integer)); e_wsfe(); } } else { ++larg; s_copy(args + (larg - 1 << 6), option, (ftnlen)64, (ftnlen)64); } ++iarg; goto L10; L11: if (options_1.lflag) { lopen_(labelfile, (ftnlen)64); } options_1.otmode = (shortint) local_(&c__0, args, args + 64, args + 128, args + 192, (ftnlen)64, (ftnlen)64, (ftnlen)64, (ftnlen)64); if ((options_1.otmode & 8) != 0) { options_1.invert = FALSE_; } else { options_1.invert = TRUE_; } return 0; } /* parse_ */ /* cc */ /* c */ /* Subroutine */ int autotile_(shortint *nax, shortint *nay, integer *modulus) { /* Format strings */ static char fmt_32[] = "(\002Autotiling on \002,a1,\002: \002,i3,\002 x" " \002,i3,\002 = \002,i5,\002 >= \002,i5)"; /* System generated locals */ integer i__1; /* Builtin functions */ integer s_wsfe(cilist *), do_fio(integer *, char *, ftnlen), e_wsfe(void); /* Fortran I/O blocks */ static cilist io___15 = { 0, 0, 0, fmt_32, 0 }; static cilist io___16 = { 0, 0, 0, fmt_32, 0 }; /* $$$$$$$$$$$$$ ARRAY SIZE LIMITS START HERE $$$$$$$$$$$$$$ */ /* Maximum number of tiles */ /* Number of shadow tiles */ /* ** (One of these can fail to be enough when the aspect ratio is */ /* ** extreme or when the model is far from being "centred" near z=0. */ /* ** Keep them well ahead of MAXNTX, MAXNTY to be on the safe side) */ /* ** EAM - Allow soft failure and monitor required values in NSXMAX,NSYMAX */ /* Maximum number of pixels per tile */ /* Maximum number of objects */ /* ** PARAMETER (MAXOBJ = 7500) */ /* Array elements available for object details */ /* Should be roughly 10*MAXOBJ */ /* ** PARAMETER (MAXDET = 150 000, MAXSDT = 150 000) */ /* ** PARAMETER (MAXDET = 2 000 000, MAXSDT = 2 000 000) */ /* Array elements available for sorted lists ("short" lists) */ /* Increased requirements as more objects are stacked behind each other */ /* ** PARAMETER (MAXSHR = 150 000, MAXSSL = 150 000) */ /* Maximum number of MATERIAL definitions (object type 8) */ /* Maximum number of stacked transparent objects at any single pixel */ /* (any further further stacking is ignored) */ /* Maximum number of non-shadowing lights (object type 13) */ /* Maximum levels of file indirection in input stream */ /* $$$$$$$$$$$$$$$$$ END OF LIMITS $$$$$$$$$$$$$$$$$$$$$$$ */ /* Other possibly platform-dependent stuff */ /* Slop is related to the accuracy (in pixels) to which we must predict */ /* shadow edges. Too low a value causes whole triangles to be spuriously */ /* in shadow; too high a value may cause shadows to be missed altogether. */ /* Perfect accuracy in floating point calculations would allow SLOP << 1. */ /* Edgeslop is similarly a kludge for dealing with triangles whose explicit */ /* normals describe wrapping around from front-facing to back-facing. */ /* Ribbonslop is a kludge so that distortion due to perspective doesn't */ /* prevent us from identifying ribbon triangles */ /* Anti-aliasing requires that NPY is a multiple of modulus */ if (*nax > 0) { raster_1.npx = *modulus; raster_1.ntx = (*nax + raster_1.npx - 1) / raster_1.npx; L21: if (raster_1.ntx % 2 == 0) { raster_1.ntx /= 2; raster_1.npx <<= 1; } else if (raster_1.ntx % 3 == 0) { raster_1.ntx /= 3; raster_1.npx *= 3; } else if (raster_1.ntx % 5 == 0) { raster_1.ntx /= 5; raster_1.npx *= 5; } else { ++raster_1.ntx; } if (raster_1.ntx > 256) { goto L21; } if (raster_1.npx < 6 && (raster_1.ntx % 2 == 0 || raster_1.ntx % 3 == 0 || raster_1.ntx % 5 == 0)) { goto L21; } if (raster_1.npx > 32) { raster_1.npx = 32 / *modulus * *modulus; raster_1.ntx = (*nax + raster_1.npx - 1) / raster_1.npx; } } if (*nay > 0) { raster_1.npy = *modulus; raster_1.nty = (*nay + raster_1.npy - 1) / raster_1.npy; L31: if (raster_1.nty % 2 == 0) { raster_1.nty /= 2; raster_1.npy <<= 1; } else if (raster_1.nty % 3 == 0) { raster_1.nty /= 3; raster_1.npy *= 3; } else if (raster_1.nty % 5 == 0) { raster_1.nty /= 5; raster_1.npy *= 5; } else { ++raster_1.nty; } if (raster_1.nty > 256) { goto L31; } if (raster_1.npy < 6 && (raster_1.nty % 2 == 0 || raster_1.nty % 3 == 0 || raster_1.nty % 5 == 0)) { goto L31; } if (raster_1.npy > 32) { raster_1.npy = 32 / *modulus * *modulus; raster_1.nty = (*nay + raster_1.npy - 1) / raster_1.npy; } } if (asscom_1.verbose && (*nax > 0 || *nay > 0)) { s_wsfe(&io___15); do_fio(&c__1, "X", (ftnlen)1); do_fio(&c__1, (char *)&raster_1.ntx, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&raster_1.npx, (ftnlen)sizeof(integer)); i__1 = raster_1.ntx * raster_1.npx; do_fio(&c__1, (char *)&i__1, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&(*nax), (ftnlen)sizeof(shortint)); e_wsfe(); s_wsfe(&io___16); do_fio(&c__1, "Y", (ftnlen)1); do_fio(&c__1, (char *)&raster_1.nty, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&raster_1.npy, (ftnlen)sizeof(integer)); i__1 = raster_1.nty * raster_1.npy; do_fio(&c__1, (char *)&i__1, (ftnlen)sizeof(integer)); do_fio(&c__1, (char *)&(*nay), (ftnlen)sizeof(shortint)); e_wsfe(); } return 0; } /* autotile_ */