Annotation of 40BSD/cmd/cifplot/fill.c, revision 1.1

1.1     ! root        1: /*******************************************************************
        !             2: *                                                                  *
        !             3: *    File: CIFPLOT/fill.c                                          *
        !             4: *    Written by Dan Fitzpatrick & Dennis Wellborne                 *
        !             5: *    copyright 1980 -- Regents of the University of California     *
        !             6: *                                                                  *
        !             7: ********************************************************************/
        !             8: 
        !             9: #include "defs.h"
        !            10: #include "globals.h"
        !            11: #include "structs.h"
        !            12: #include "out_structs.h"
        !            13: #include "masks.h"
        !            14: #include <stdio.h>
        !            15: #include <sys/types.h>
        !            16: #include <sys/stat.h>
        !            17: #include <sys/vcmd.h>
        !            18: #include <signal.h>
        !            19: #include <errno.h>
        !            20: 
        !            21: extern int errno;
        !            22: 
        !            23: int plotmd [] = { VPLOT, 0, 0 };
        !            24: int prtmd  [] = { VPRINT, 0, 0 };
        !            25: struct stat stbuf;
        !            26: int offline;
        !            27: int Lock = 0;
        !            28: char *tail = "a";      /* letter appended to temp file name for uniqueness */
        !            29: int NormalSize;
        !            30: double StartNextPlot;
        !            31: 
        !            32: IMPORT char *Concat();
        !            33: IMPORT char *mktemp();
        !            34: IMPORT char *getlogin();
        !            35: IMPORT char *ctime();
        !            36: IMPORT time();
        !            37: 
        !            38: #define VLIMIT  2112
        !            39: #define VMAX   2000
        !            40: #define VEXTRA 2100
        !            41: #define VMIN   0
        !            42: #define VRESOL 200.0
        !            43: #define VSPLFL "/usr/spool/vad/dfcXXXXXX"
        !            44: #define VDAEMON "/vb/grad/fitz/graphics/vad"
        !            45: 
        !            46: #define WLIMIT 7040
        !            47: #define        WMAX    7000
        !            48: #define        WEXTRA  7030
        !            49: #define WMIN   0
        !            50: #define WRESOL 200.0
        !            51: #define WSPLFL "/usr/spool/vpd/dfcXXXXXX"
        !            52: #define WDAEMON "/vb/grad/fitz/graphics/vpd"
        !            53: 
        !            54: #define HLIMIT  704
        !            55: #define HMAX   700
        !            56: #define HMIN   0
        !            57: #define HRESOL  10.0
        !            58: 
        !            59: #define LOCK   "/usr/spool/vpd/lock"
        !            60: #define DEVICE "/dev/vp0"
        !            61: #define NAME   "Versatec"
        !            62: #define DAEMON "/vb/grad/fitz/graphics/vpd"
        !            63: #define VDUMP  "/usr/ucb/vdump"
        !            64: #define VDMP   "/vb/grad/fitz/graphics/vdmp"
        !            65: 
        !            66: int xmax,xlimit,xlimitDiv32,xmin;
        !            67: real resolution = 200;
        !            68: char *heading,*name;
        !            69: 
        !            70: #ifdef  SHIFT
        !            71: #define FROMMASK(from) ( 0xffffff00 | (0xff >> (from & 0x07))) << (from & 0x18)
        !            72: 
        !            73: #define TOMASK(to)             (~((0xffffff00 | (0xff >> (to & 0x07))) << (to & 0x18)))
        !            74: #else
        !            75: #define FROMMASK(from)  fromMask[from&0x1f]
        !            76: #define TOMASK(to)      toMask[to&0x1f]
        !            77: #endif
        !            78: #define DOTMASK(x)     dotMask[x&0x1f]
        !            79: 
        !            80: char *outfile;
        !            81: int filedesc;
        !            82: int *OutBuf,*ScanLine;
        !            83: int NoLine;
        !            84: 
        !            85: 
        !            86: Fill(line,from,to,pattern)
        !            87: int from,to;
        !            88: register int pattern;
        !            89: {
        !            90:     int start,end;
        !            91:     register int i;
        !            92: 
        !            93:     to++;
        !            94:     if(to < from || xlimit < to || from < 0) { 
        !            95:        /* fprintf(stderr,"Out of range in fill(%d,%d)\n",from,to); */
        !            96:        return;
        !            97:        }
        !            98:     start = (from >> 5) + ((line - Bottom) % OUT_BUF_SIZE)*xlimitDiv32;
        !            99:     end = (to >> 5) + ((line - Bottom) % OUT_BUF_SIZE)*xlimitDiv32;
        !           100: 
        !           101:     if (start == end)
        !           102:                OutBuf[start] |= pattern & (FROMMASK(from)) & (TOMASK(to));
        !           103:        else {
        !           104:                OutBuf[start] |= pattern & (FROMMASK(from));
        !           105: 
        !           106:                for (i=start+1; i<end;)
        !           107:                        OutBuf[i++] |= pattern;
        !           108:                
        !           109:                OutBuf[end] |= pattern & TOMASK(to);
        !           110:                }
        !           111: }
        !           112: 
        !           113: #define ORDER(x,y)     if(x > y) { temp=x; x=y;y=temp;}
        !           114: 
        !           115: FillTrap(xLeft,xRight,deltaxLeft,deltaxRight,yBottom,yTop,patNo)
        !           116: real xLeft,xRight,deltaxLeft,deltaxRight;
        !           117: int yTop,yBottom;
        !           118: int patNo;
        !           119: {
        !           120:     register int xStart,xEnd,from,to;
        !           121:     register int i,pattern;
        !           122:     int y,yStart,yEnd;
        !           123:     int n,temp;
        !           124: 
        !           125:     if(yBottom > yTop) Error("yBottom > yTop in FillTrap",INTERNAL);
        !           126:     yStart = (yBottom - Bottom) % OUT_BUF_SIZE;
        !           127:     yEnd = (yTop - yBottom) + yStart;
        !           128:     if(yEnd > OUT_BUF_SIZE || yStart < 0) Error("Trap bigger than buf size",INTERNAL);
        !           129: 
        !           130:     if(!(deltaxLeft == 0.0 && deltaxRight ==  0.0)) {
        !           131:        for(y=yStart; y<yEnd; y++) {
        !           132:            from = xLeft;
        !           133:            to = xRight+1;
        !           134:            if(to < from || xlimit < to || from < 0) { 
        !           135:                /* fprintf(stderr,"Out of range in fill(%d,%d)\n",from,to); */
        !           136:                return;
        !           137:                }
        !           138:            xStart = (from >> 5) + (y*xlimitDiv32);
        !           139:            xEnd = (to >> 5) + (y*xlimitDiv32);
        !           140:            pattern = Pats[patNo][y%NO_PAT_LINE];
        !           141:            if(pattern != 0) {
        !           142:                if(xStart == xEnd)
        !           143:                    OutBuf[xStart] |= pattern & (FROMMASK(from)) & (TOMASK(to));
        !           144:                  else {
        !           145:                    OutBuf[xStart] |= pattern & (FROMMASK(from));
        !           146:                    for(i=xStart+1; i<xEnd;)
        !           147:                        OutBuf[i++] |= pattern;
        !           148:                    OutBuf[xEnd] |= pattern & (TOMASK(to));
        !           149:                    }
        !           150:                }
        !           151:            if(outline || pattern == 0xffffffff) {
        !           152:                to = xLeft + deltaxLeft;
        !           153:                ORDER(from,to); to++;
        !           154:                xStart = (from >> 5) + (y*xlimitDiv32);
        !           155:                n = (to >> 5) + (y*xlimitDiv32);
        !           156:                if(xStart == n)
        !           157:                    OutBuf[xStart] |= 0xffffffff & (FROMMASK(from)) & (TOMASK(to));
        !           158:                  else {
        !           159:                    OutBuf[xStart] |= 0xffffffff & (FROMMASK(from));
        !           160:                    for(i=xStart+1; i<n;)
        !           161:                        OutBuf[i++] |= 0xffffffff;
        !           162:                    OutBuf[n] |= 0xffffffff & (TOMASK(to));
        !           163:                    }
        !           164:                to = xRight;
        !           165:                from = xRight + deltaxRight;
        !           166:                ORDER(from,to); to++;
        !           167:                n = (from >> 5) + (y*xlimitDiv32);
        !           168:                xEnd = (to >> 5) + (y*xlimitDiv32);
        !           169:                if(n == xEnd)
        !           170:                    OutBuf[n] |= 0xffffffff & (FROMMASK(from)) & (TOMASK(to));
        !           171:                  else {
        !           172:                    OutBuf[n] |= 0xffffffff & (FROMMASK(from));
        !           173:                    for(i=n+1; i<xEnd;)
        !           174:                        OutBuf[i++] |= 0xffffffff;
        !           175:                    OutBuf[xEnd] |= 0xffffffff & (TOMASK(to));
        !           176:                    }
        !           177:                }
        !           178:            xLeft += deltaxLeft;
        !           179:            xRight += deltaxRight;
        !           180:            }
        !           181:        }
        !           182:       else {
        !           183:        from = xLeft;
        !           184:        to = xRight+1;
        !           185:        if(to < from || xlimit < to || from < 0) { 
        !           186:            /* fprintf(stderr,"Out of range in fill(%d,%d)\n",from,to); */
        !           187:            return;
        !           188:            }
        !           189:        xStart = (from >> 5) + (yStart*xlimitDiv32);
        !           190:        xEnd = (to >> 5) + (yStart*xlimitDiv32);
        !           191:        for(y=yStart; y<yEnd; y++) {
        !           192:            pattern = Pats[patNo][y%NO_PAT_LINE];
        !           193:            if(pattern != 0) {
        !           194:                if(xStart == xEnd)
        !           195:                    OutBuf[xStart] |= pattern & (FROMMASK(from)) & (TOMASK(to));
        !           196:                  else {
        !           197:                    OutBuf[xStart] |= pattern & (FROMMASK(from));
        !           198:                    for(i=xStart+1; i<xEnd;)
        !           199:                        OutBuf[i++] |= pattern;
        !           200:                        OutBuf[xEnd] |= pattern & (TOMASK(to));
        !           201:                    }
        !           202:                }
        !           203:            if(outline || pattern == 0xffffffff) {
        !           204:                OutBuf[xStart] |= DOTMASK(from);
        !           205:                OutBuf[xEnd] |= DOTMASK(to);
        !           206:                }
        !           207:            xEnd += xlimitDiv32;
        !           208:            xStart += xlimitDiv32;
        !           209:            }
        !           210:        }
        !           211:     }
        !           212: 
        !           213: blank(from,to,line)
        !           214: int from,to;
        !           215: {
        !           216:     int start,end;
        !           217:     register int i;
        !           218: 
        !           219:     to++;
        !           220:     if(to < from || xlimit < to || from < 0) { 
        !           221:        /* fprintf(stderr,"Out of range in blank(%d,%d)\n",from,to); */
        !           222:        return;
        !           223:        }
        !           224:     start = (from >> 5) + ((line - Bottom) % OUT_BUF_SIZE)*xlimitDiv32;
        !           225:     end = (to >> 5) + ((line - Bottom) % OUT_BUF_SIZE)*xlimitDiv32;
        !           226: 
        !           227:     if (start == end)
        !           228:                OutBuf[start] &= ~((FROMMASK(from)) & (TOMASK(to)));
        !           229:        else {
        !           230:                OutBuf[start] &= ~(FROMMASK(from));
        !           231: 
        !           232:                for (i=start+1; i<end;)
        !           233:                        OutBuf[i++] = 0;
        !           234:                
        !           235:                OutBuf[end] &=  ~(TOMASK(to));
        !           236:                }
        !           237: }
        !           238: 
        !           239: match(pat,pos,line)
        !           240: int pat,pos,line;
        !           241: {
        !           242:     int pat1,pat2,offset;
        !           243: 
        !           244:     line = (line-Bottom) % OUT_BUF_SIZE;
        !           245:     offset = (line*xlimitDiv32);
        !           246:     pat &= 0xff;
        !           247:     /*
        !           248:     pat1 = ((0xff >> (pos & 07)) & 0xff) << (pos & 0x18);
        !           249:     OutBuf[(pos>>5)+offset] &= ~pat1;
        !           250:     */
        !           251:     pat1 = ((pat >> (pos & 07)) & 0xff) << (pos & 0x18);
        !           252:     OutBuf[(pos>>5)+offset] |= pat1;
        !           253:     pos += 8;
        !           254:     /*
        !           255:     pat2 = ((0xff00 >> (pos & 07)) & 0xff) << (pos & 0x18);
        !           256:     OutBuf[(pos>>5)+offset] &= ~pat2;
        !           257:     */
        !           258:     pat = pat << 8;
        !           259:     pat2 = ((pat >> (pos & 07)) & 0xff) << (pos & 0x18);
        !           260:     OutBuf[(pos>>5)+offset] |= pat2;
        !           261:     }
        !           262: 
        !           263: /*
        !           264: ClearLine(){
        !           265:     register int i,limit;
        !           266:     limit = (OUT_BUF_SIZE*xlimit)/32;
        !           267:     for(i=0; i<limit ; OutBuf[i++] = 0);
        !           268:     }
        !           269:     */
        !           270: 
        !           271: Clear(lp, nbytes)
        !           272:        int *lp;
        !           273:        int nbytes;
        !           274: {
        !           275: 
        !           276:        asm("movc5 $0,(sp),$0,8(ap),*4(ap)");
        !           277: 
        !           278: }
        !           279: 
        !           280: DumpBuf(x)
        !           281: int x;
        !           282: {
        !           283:     int i;
        !           284:     for(i=xLast; i < x; i++) Text(i);
        !           285:     if(plot) {
        !           286:        if(write(filedesc, OutBuf, (OUT_BUF_SIZE*xlimit)/8) != (OUT_BUF_SIZE*xlimit/8)) {
        !           287:            perror(outfile);
        !           288:            if(output != VERSATEC)
        !           289:                Error("Bad Write on temp file",RUNTIME);
        !           290:              else
        !           291:                Error("Looks like someone turned off the Versatec",RUNTIME);
        !           292:            }
        !           293:        Clear(OutBuf,(OUT_BUF_SIZE*xlimit)/8);
        !           294:        xLast = x;
        !           295:        }
        !           296:     }
        !           297: 
        !           298: /*
        !           299: DumpLine()
        !           300: {
        !           301:     NoLine++;
        !           302:     if(NoLine == OUT_BUF_SIZE) {
        !           303:        if(plot)
        !           304:        if(write( filedesc, OutBuf, (OUT_BUF_SIZE*xlimit)/8) != (OUT_BUF_SIZE*xlimit/8)) {
        !           305:            perror(outfile);
        !           306:            if(output != VERSATEC)
        !           307:                Error("Bad Write on temp file",RUNTIME);
        !           308:              else
        !           309:                Error("Looks like someone turned off the Versatec",RUNTIME);
        !           310:            }
        !           311:        Clear(OutBuf,(OUT_BUF_SIZE*xlimit)/8);
        !           312:        NoLine = 0;
        !           313:        }
        !           314:     ScanLine = &(OutBuf[(NoLine*xlimit)/32]);
        !           315:     }
        !           316:     */
        !           317: 
        !           318: FlushLine()
        !           319: {
        !           320:     NoLine++;
        !           321:     if(plot)
        !           322:       if(write( filedesc, &(OutBuf[0]), (NoLine*xlimit)/8) != (NoLine*xlimit)/8) {
        !           323:         perror(outfile);
        !           324:         Error("Bad Write on temp file",RUNTIME);
        !           325:         }
        !           326:     Clear(OutBuf,(OUT_BUF_SIZE*xlimit)/8);
        !           327:     NoLine = 0;
        !           328:     ScanLine = OutBuf;
        !           329:     }
        !           330: 
        !           331: InitFill(){
        !           332:     switch(output) {
        !           333:        case VARIAN:
        !           334:                xlimit = VLIMIT;
        !           335:                NoPixcels = NormalSize = VMAX;
        !           336:                xmax = VEXTRA;
        !           337:                xmin = VMIN;
        !           338:                resolution = VRESOL;
        !           339:                break;
        !           340:        case VSPOOL:
        !           341:        case VERSATEC:
        !           342:                xlimit = WLIMIT;
        !           343:                NoPixcels = NormalSize = WMAX;
        !           344:                xmax = WEXTRA;
        !           345:                xmin = WMIN;
        !           346:                resolution = WRESOL;
        !           347:                break;;
        !           348:        case HP2648A:
        !           349:                xlimit = HLIMIT;
        !           350:                NoPixcels = NormalSize = xmax = HMAX;
        !           351:                xmin = HMIN;
        !           352:                resolution = HRESOL;
        !           353:                break;;
        !           354:        default:
        !           355:                Error("Unknown output device in InitFill",INTERNAL);
        !           356:        }
        !           357:     OutBuf = (int *) alloc((int) ((OUT_BUF_SIZE * xlimit)/8));
        !           358:     ScanLine = OutBuf;
        !           359:     NoLine = 0;
        !           360:     xlimitDiv32 = xlimit/32;
        !           361:     }
        !           362: 
        !           363: 
        !           364: vopen()
        !           365: {
        !           366:     char s[256];
        !           367:     int i;
        !           368:     long clock;
        !           369:   
        !           370:     name = getlogin();
        !           371:     if(Window.ymax != Window.ymin)     /* Check for divide by zero */
        !           372:     sprintf(s,"%s Window: %d %d %d %d --- Scale: 1 micron is %f inches",
        !           373:        programName,(int)Window.xmin,(int)Window.xmax,
        !           374:        (int)Window.ymin,(int)Window.ymax,scale);
        !           375:     heading = Concat(s,"\n",banner,0);
        !           376: 
        !           377: 
        !           378:     if((output==VARIAN || output==HP2648A) && plot) {
        !           379:        outfile = (char *) mktemp("/usr/tmp/cifXXXXXX");
        !           380:        outfile = Concat(outfile,tail,0);
        !           381:        *tail += 1;     /* insures uniqueness */
        !           382:        if((filedesc = creat(outfile,0666)) < 0) {
        !           383:                perror(outfile);
        !           384:                Error("Can't create temp file",RUNTIME);
        !           385:                }
        !           386:        fileopen = 1;
        !           387:        }
        !           388: 
        !           389:     if(output==VSPOOL && plot) {
        !           390:        outfile = (char *) mktemp("/usr/tmp/cifXXXXXX");
        !           391:        outfile = Concat(outfile,tail,0);
        !           392:        *tail += 1;     /* insures uniqueness */
        !           393:        if((filedesc = creat(outfile,0666)) < 0) {
        !           394:                perror(outfile);
        !           395:                Error("Can't create temp file",RUNTIME);
        !           396:                }
        !           397:        fileopen = 1;
        !           398:        }
        !           399: 
        !           400:      if(output==VERSATEC && plot) {
        !           401:        /* Drive the Versatec directly */
        !           402:        while( stat(LOCK, &stbuf) >= 0) {
        !           403:                sleep(30);
        !           404:                }
        !           405: 
        !           406:        if( (i = creat(LOCK, 0666)) < 0) {
        !           407:                perror(LOCK);
        !           408:                Error("Can't create lock file",RUNTIME);
        !           409:                }
        !           410:         if( close(i) < 0) {
        !           411:                perror(LOCK);
        !           412:                Error("Can't close lock file",RUNTIME);
        !           413:                }
        !           414:         
        !           415:        Lock = 1;
        !           416:        while(1) {
        !           417:                if( (filedesc = open(DEVICE, 1)) >= 0) break;
        !           418:                if( errno != EIO ) {
        !           419:                        perror(DEVICE);
        !           420:                        Error("I/O Error",RUNTIME);
        !           421:                        }
        !           422:                if(offline == 0) {
        !           423:                        fprintf(stderr,"%s is offline\n",NAME);
        !           424:                        offline = 1;
        !           425:                        }
        !           426:                sleep(30);
        !           427:                }
        !           428:        fileopen = 1;
        !           429:        fprintf(stderr,"Plotting\n");
        !           430:        ioctl(filedesc,VSETSTATE,prtmd);
        !           431:        clock = time(0);
        !           432:        sprintf(s,"%s: %s",getlogin(),ctime(&clock));
        !           433:        if(write(filedesc,s,LengthString(s)) != LengthString(s) ||
        !           434:           write(filedesc,heading,LengthString(heading)) != LengthString(heading)) {
        !           435:                perror("");
        !           436:                Error("Can't write on Versatec",RUNTIME);
        !           437:                }
        !           438:        write(filedesc,"\n\n",2);
        !           439:        ioctl(filedesc,VSETSTATE,plotmd);
        !           440:         }
        !           441:     }
        !           442: 
        !           443: vclose()
        !           444: {
        !           445:     int i;
        !           446:     fileopen = 0;
        !           447:     FlushLine();
        !           448:     if(plot && close(filedesc) < 0) {
        !           449:        perror("outfile");
        !           450:        Error("Can't close temp file",RUNTIME);
        !           451:        }
        !           452: 
        !           453:     if(output==VERSATEC) {
        !           454:        ioctl(filedesc,VSETSTATE,prtmd);
        !           455:        for(i=0; i < 10; i++)
        !           456:            write(filedesc,"\n\n\n\n\n\n\n\n\n\n",10);
        !           457:        unlock();
        !           458:        Lock = 0;
        !           459:        fprintf(stderr,"Plotting Done\n");
        !           460:        }
        !           461: 
        !           462:     if(plot && (output==VARIAN)) /* || output==VSPOOL)) */
        !           463:        if(vfork() == 0)
        !           464:            if(! 1) {
        !           465:                char *tmpFile;
        !           466:                char *spoolFile;
        !           467:                FILE *tmp;
        !           468:                tmpFile = mktemp("/usr/tmp/cpltXXXXXX");
        !           469:                if(output==VARIAN)
        !           470:                    spoolFile = mktemp(VSPLFL);
        !           471:                  else
        !           472:                    spoolFile = mktemp(WSPLFL);
        !           473:                spoolFile = Concat(spoolFile,tail,0);
        !           474:                if((tmp = fopen(tmpFile,"w")) == NULL) {
        !           475:                    perror(tmpFile);
        !           476:                    Error("Can't open temp spool file",RUNTIME);
        !           477:                    }
        !           478:                fprintf(tmp,"L%s\n",name);
        !           479:                fprintf(tmp,"B%s\n",heading);
        !           480:                fprintf(tmp,"B%s\n",banner);
        !           481:                fprintf(tmp,"C%s\n",outfile);
        !           482:                fprintf(tmp,"U%s\n",outfile);
        !           483:                fclose(tmp);
        !           484:                link(tmpFile,spoolFile);
        !           485:                unlink(tmpFile);
        !           486:                if(output==VARIAN)
        !           487:                        execl(VDAEMON,"vad",0);
        !           488:                    else
        !           489:                        execl(WDAEMON,"vpd",0);
        !           490:                Error("Can't start up daemon",RUNTIME);
        !           491:                }
        !           492:              else {
        !           493:                if(execl(VDUMP,"vdump",outfile,heading,"Plotting Done",0) < 0) {
        !           494:                    perror(VDUMP);
        !           495:                    Error("Can't start up plotting routine",RUNTIME);
        !           496:                    }
        !           497:                }
        !           498: 
        !           499:     if(plot && output==VSPOOL)
        !           500:        if(vfork() == 0)
        !           501:            if(!debug) {
        !           502:                if(execl(VDUMP,"vdump",outfile,heading,"","-W",0) < 0) {
        !           503:                    perror(VDUMP);
        !           504:                    Error("Can't start up plotting routine",RUNTIME);
        !           505:                    }
        !           506:                }
        !           507:              else {
        !           508:                if(execl(VDUMP,"vdump",outfile,heading,"Plotting Done","-W",0) < 0) {
        !           509:                    perror(VDUMP);
        !           510:                    Error("Can't start up plotting routine",RUNTIME);
        !           511:                    }
        !           512:                }
        !           513:   }
        !           514: 
        !           515: unlock()
        !           516: {
        !           517:     if(output==VERSATEC && Lock) {
        !           518:        if(unlink(LOCK) < 0) {
        !           519:                perror(LOCK);
        !           520:                Error("Can't remove lock",RUNTIME);
        !           521:                }
        !           522:        if(vfork()==0) {
        !           523:            if(execl(DAEMON,DAEMON) < 0) {
        !           524:                perror(DAEMON);
        !           525:                Error("Can't start up daemon",RUNTIME);
        !           526:                }
        !           527:            }
        !           528:        }
        !           529:     }
        !           530: 
        !           531: float
        !           532: PlotSize()
        !           533: {
        !           534:     return(((float) (Top-Bottom))/(resolution * 12.0));
        !           535:     }
        !           536: 
        !           537: float
        !           538: PlotScale()
        !           539: {
        !           540:    if(Window.ymax == Window.ymin) return(0.0);
        !           541:    return((100.0 * ((real) xmax))/(resolution * (Window.ymax-Window.ymin)));
        !           542:    }
        !           543: 
        !           544: FixScale()
        !           545: /* Set up the correct conversion factor for chip to plotter conversion*/
        !           546: {
        !           547:     if(SetScale && scale != 0.0) {
        !           548:        ConvertFactor = (scale * resolution)/100.0;
        !           549:        StartNextPlot = GWindow.ymin;
        !           550:        NoPixcels = xmax;
        !           551:        }
        !           552:       else {
        !           553:        if(GWindow.ymax == GWindow.ymin) {
        !           554:            ConvertFactor = 0.0;
        !           555:            scale = 0.0;
        !           556:            }
        !           557:          else {
        !           558:            ConvertFactor = NormalSize/(GWindow.ymax - GWindow.ymin);
        !           559:            scale = 100.0 * ((real) NoPixcels)/(resolution * (GWindow.ymax-GWindow.ymin));
        !           560:            }
        !           561:        StartNextPlot = GWindow.ymin;
        !           562:        }
        !           563:     }
        !           564: 
        !           565: AdjustWindow()
        !           566: {
        !           567:        Window.xmin = GWindow.xmin;
        !           568:        Window.xmax = GWindow.xmax;
        !           569:        Window.ymin = StartNextPlot;
        !           570:        Window.ymax = NoPixcels/ConvertFactor + Window.ymin;
        !           571:        StartNextPlot = NormalSize/ConvertFactor + Window.ymin;
        !           572:        if(Window.ymax < GWindow.ymax-1) {
        !           573:            MoreToPlot = ((GWindow.ymax - Window.ymax)*ConvertFactor)/NormalSize + 0.9999;
        !           574:            }
        !           575:          else {
        !           576:            MoreToPlot = 0;
        !           577:            Window.ymax = GWindow.ymax;
        !           578:            NoPixcels = CONVERT(Window.ymax) + 1;
        !           579:            }
        !           580:     }
        !           581: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.